【发布时间】:2015-10-03 07:23:29
【问题描述】:
我正在努力学习SGDRegressor。我生成自己的数据,但我不知道如何将其融入算法。我收到此错误。
x = np.random.randint(100, size=1000)
y = x * 0.10
clf = linear_model.SGDRegressor()
clf.fit(x, y, coef_init=0, intercept_init=0)
找到样本数不一致的数组:[1 1000]
我是 python 和机器学习的新手。我错过了什么?
【问题讨论】:
-
x的形状不正确。试试x = x.reshape(1000,) -
您能否将其添加到答案中以便我接受?
标签: python arrays numpy scikit-learn linear-regression