You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the line tmptheta = theta
should be updated to tmptheta = np.copy(theta) // create a deep copy of theta instead of a new reference!
Otherwise the below statement will update theta also while the tmptheta is being updated (as both are references to same object!). theta should NOT change during an iteration of gradient descent! tmptheta[j] = theta[j] - (alpha/m)*np.sum((h(theta,X) - y)*np.array(X[:,j]).reshape(m,1))
The text was updated successfully, but these errors were encountered:
the line
tmptheta = theta
should be updated to
tmptheta = np.copy(theta)
// create a deep copy of theta instead of a new reference!Otherwise the below statement will update theta also while the tmptheta is being updated (as both are references to same object!). theta should NOT change during an iteration of gradient descent!
tmptheta[j] = theta[j] - (alpha/m)*np.sum((h(theta,X) - y)*np.array(X[:,j]).reshape(m,1))
The text was updated successfully, but these errors were encountered: