【发布时间】:2017-10-24 10:59:15
【问题描述】:
我正在尝试使用 sklearn 进行简单的回归,但我不明白如何手动制作自己的数据
import numpy as np
from sklearn import linear_model
Y = np.array([22000, 13400, 47600, 7400, 12000, 32000, 28000, 31000, 69000, 48600])
X = np.array([0.62, 0.24, 0.89, 0.11, 0.18, 0.75, 0.54, 0.61, 0.92, 0.88])
# Create linear regression object
regr = linear_model.LinearRegression()
# Train the model using the training sets
regr.fit(X, Y)
我收到此错误:
ValueError: Found arrays with inconsistent numbers of samples: [ 1 10]
【问题讨论】:
标签: python scikit-learn