|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- regressor = LinearRegression()
- regressor.fit(X_train,y_train)
复制代码
- ValueError: Expected 2D array, got 1D array instead:
- array=[14 67 69 61 0 32 51 47 36 16 24 18 19 28 11 43 66 34 35 70 46 41 60 52
- 73 72 33 62 44 3 57 26 6 48 10 65 8 9 15 40 50 13 4 5 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/ ... nearRegression.html
|
|