本文主要是介绍Expected 2D array, got 1D array instead:Reshape your data either using array.reshape(-1, 1) if your,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Expected 2D array, got 1D array instead: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.
错误代码:
model.fit(x_train,y_train)
新版sklearn中,所有数据都应为二维矩阵,独行独列也应是二维。
正确代码:
model.fit(x_train.reshqp(-1,1),y_train)
这篇关于Expected 2D array, got 1D array instead:Reshape your data either using array.reshape(-1, 1) if your的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!