NameError Traceback (most recent call last) /var/folders/jj/vz79ltc157bfgstg9_hvqqw80000gn/T/ipykernel_1000/3742952677.py in <module> ----> 1 theta, error_list = gradientDescent(X,y) NameError: name 'y' is not defined

def gradient(X,Y,theta):
m = X.shape[0]
grad = np.zeros((2,))

for i in range(m):
    y_ = hypthesis(X[i],theta)
    y = Y[i]
    grad[0] += (y_ - y)
    grad[1] += (y_ - y)*x
    
return grad/m

EVEN THOUGH I HAVE DEFINED y = Y[i], in this function

Hello @vedansh04122014_8289db2987b007d3,
Have you defined any function named gradientDescent(X,y) yourself. Pls share the whole code.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.