New answers tagged


Commenters are correct - you confuse vector and scalar operations. The formula is scalar one, and here is how you can implement it: for n in range(num_iters): for j in range(len(theta)): sum_j = 0 for i in range(len(X)): temp = X[i, j]*theta[j] - y[i] temp = temp * X[i, j] sum_j += temp ...

Top 50 recent answers are included