问题描述
def gradientDescent(X,y,theta,alpha,i):
J = [] #cost function in each iterations
k = 0
while k < i:
y1 = hypothesis(theta,X)
y1 = np.sum(y1,axis=1)
for c in range(0,len(X.columns)):
theta[c] = theta[c] - alpha*(sum((y1-y)*X.iloc[:,c])/len(X))
j = computeCost(X,theta)
J.append(j)
k += 1
return J,j,theta
J,theta = gradientDescent(X,0.05,10000)
Traceback (most recent call last)
<ipython-input-64-d17a8fb83984> in <module>()
----> 1 J,10000)
<ipython-input-62-bfec0d0edcfa> in gradientDescent(X,i)
6 y1 = np.sum(y1,axis=1)
7 for c in range(0,len(X.columns)):
----> 8 theta[c] = theta[c] - alpha*(sum((y1-y)*X.iloc[:,c])/len(X))
9 j = computeCost(X,theta)
10 J.append(j)
TypeError: 'numpy.int64' object is not callable
我希望立即有任何解决方案。谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)