实施梯度下降后获得负的负无穷大值
def derivative(w,w0,X,alpha,y):
j_wi = 0
j_w0 = 0
for j in range(0,100):
for i in range(0,X.shape[0]):
j_wi += (y[i] - (np.sum((w*X[i]) + w0, axis =0))) * (-X[i])
j_w0 += -(y[i] - (np.sum(w * X[i] + w0)))
j_wi = 2*j_wi/X.shape[0]
j_w0 = 2*j_w0/X.shape[0]
w = w-(alpha*j_wi)
w0 = w0-(alpha*j_w0)
return w, w0