Error with Sklearn Random Forest Regressor

点点圈 提交于 2019-12-05 00:46:41

The shape of X should be [n_samples, n_features], you can transform X by

X = X[:, None]

It is treating your list of samples X as 1 sample as a vector so the following works

rgr = regressor.fit(map(lambda x: [x],X),y)

There might be a more efficient way of doing this in numpy with vstack.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!