本文主要是介绍成功解决Fit Failed Warning: Estimator fit failed. The score on this train-test错误,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
成功解决Fit Failed Warning: Estimator fit failed. The score on this train-test错误
在利用sklearn进行随机森林分类时发生了Fit Failed Warning: Estimator fit failed. The score on this train-test错误,如下图所示:
经过查阅相关资料发现导致这一错误是因为我们向分类器传入了浮点型数据,随机森林接受的是整型数据。
可以使用sklearn的labelEncoder函数来转换你的训练分数,也可以自己将浮点数据变为整形数据。将代码更改后错误消失:
这篇关于成功解决Fit Failed Warning: Estimator fit failed. The score on this train-test错误的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!