sklearn LinearRegression对数据格式的要求是什么呀
regressor = LinearRegression()regressor.fit(X_train,y_train)
ValueError: Expected 2D array, got 1D array instead:
array=[14 67 69 610 32 51 47 36 16 24 18 19 28 11 43 66 34 35 70 46 41 60 52
73 72 33 62 443 57 266 48 10 6589 15 40 50 1345 23 17 22 64
27 68].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
这是什么情况呢 fit的参数需要填的是数据+特征数
x: {array-like, sparse matrix} of shape (n_samples, n_features)
Training data
y: array-like of shape (n_samples,) or (n_samples, n_targets)
Target values. Will be cast to X’s dtype if necessary
自己查官网文档不香吗?
https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html BngThea 发表于 2020-4-20 19:13
fit的参数需要填的是数据+特征数
谢谢谢谢!
页:
[1]