用
x=[[6],[8],[10],[14],[18]]
y=[[7],[9],[13],[17.5],[18]]
是正确的,但是使用
x=[6,8,10,14,18]
y=[7,9,13,17.5,18]
就会报错
DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and will raise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.
DeprecationWarning)
ValueError: Found input variables with inconsistent numbers of samples: [1, 5]
网址
http://www.jianshu.com/p/738f...
相关介绍没有看懂,惭愧。。。
http://scikit-learn.org/stabl...
以
1维数组
来传递数据在0.19版本将触发ValueError
。用
X.reshape(-1, 1)
来重塑数据的形状(数组的维度)一周热门 更多>