I got stucked at a point where I am implementing gradient descent in python.
The formula for gradient descent is:
for iter in range(1, num_iters):
hypo_function = np.sum(np.dot(np.dot(theta.T, X)-y, X[:,iter]))
theta_0 = theta[0] - alpha * (1.0 / m) * hypo_function
theta_1 = theta[1] - alpha * (1.0 / m) * hypo_function
Got an error:
---> hypo_function = np.sum(np.dot(np.dot(theta.T, X)-y, X[:,iter])) ValueError: shapes (1,97) and (2,) not aligned: 97 (dim 1) != 2 (dim 0)
PS: Here my X is (2L, 97L), y is (97L,) theta is (2L,).