试图运用一个简单的线性回归模型来预测数据中给定的高速公路mpg下的汽车价格当我把它们放在线性模型函数中时,python说它得到的是1D的答案,而预期的是2D我该怎么解决这个问题。我无法获得python在错误中给出的概念(-1,1)和(1,-1)。
ValueError Traceback (most recent call last)
in ()
----> 1 lm.fit(x,y)
~\Anaconda3\lib\site-packages\sklearn\linear_model\base.py in fit(self, X, y, sample_weight)
480 n_jobs_ = self.n_jobs
481 X, y = check_X_y(X, y, accept_sparse=['csr', 'csc', 'coo'],
--> 482 y_numeric=True, multi_output=True)
483
484 if sample_weight is not None and np.atleast_1d(sample_weight).ndim > 1:
~\Anaconda3\lib\site-packages\sklearn\utils\validation.py in check_X_y(X, y, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, multi_output, ensure_min_samples, ensure_min_features, y_numeric, warn_on_dtype, estimator)
571 X = check_array(X, accept_sparse, dtype, order, copy, force_