问题描述
我有一组点 x 和 y:
sport numpy as np
np.random.seed(11)
x = np.linspace(0,10,98)
y = 5.0*x + 2.0 + np.random.uniform(-1.0,1.0,x.shape)
我想使用梯度下降来拟合它:
from sklearn.linear_model import SGDRegressor
grad_desc = SGDRegressor()
best_fit = grad_desc.fit(x,y)
但它给了我这个错误:
ValueError: Expected 2D array,got 1D array instead:
为什么会这样?怎么处理?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)