air quality prediction

gradient descent function not converging
i was trying to solve problem using gradient descent algo with convergence rule of change in error bt it’s not working properly.please help

def hypothesis(x,theta):
hx=theta[0]
for i in range(x.shape[0]):
hx+=theta[i]*x[i]
return hx
def gradient(x,y,theta):
grad=np.zeros((theta.shape[0],))
for i in range(x.shape[0]):
hx=hypothesis(x[i],theta)
grad[0]+=(hx-y[i])
j=1
while j<(grad.shape[0]):
grad[j]+=(hx-y[i])x[i][j-1]
j=j+1
return grad
def error(x,y,theta):
m=x.shape[0]
err=0
for i in range(m):
hx=hypothesis(x[i],theta)
err+=(hx-y[i])**2
return err/2
def gradientdescent(x,y,learning_rate=0.001):
theta=np.zeros((x.shape[1]+1,))
err=error(x,y,theta)
del_err=err
itr=1
while del_err>0.01:
grad=gradient(x,y,theta)
for i in range(theta.shape[0]):
theta[i]=theta[i]-learning_rate
grad[i]
m=error(x,y,theta)
del_err=abs(m-err)
err=m
print(err)
return theta