python 机器学习弃用警告

python machine learning DeprecationWarning

你能帮我解决这个问题吗?

C:\Python27\lib\site-packages\sklearn\cross_validation.py:44‌: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also, note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20. "This module will be removed in 0.20.", DeprecationWarning)

C:\Python27\lib\site-packages\sklearn\cross_validation.py:44‌: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also, note that the interface of the new CV iterators is different from that of this module. This module will be removed in 0.20. "This module will be removed in 0.20.", DeprecationWarning)

只是一个 弃用警告


不用担心,但请记住 cross_val 将在 0.20 中删除。

这个错误只是为了警告你,开发人员会在他们这样做之前移动这个功能。


只是一个 example.In 我们将不得不更换的未来:

from sklearn.cross_validation import KFold

与:

 from sklearn.model_selection import KFold

对于我在您发布的屏幕截图中看到的 第二个错误SA3L module 似乎没有安装。

现在 cross_validation 已被弃用,取而代之的是 model_selection,但是所有方法和 类 保持不变。您现在只需导入:

from sklearn import model_selection

要训练和测试数据,您必须执行以下操作:

x_train,x_test,y_train,y_test=model_selection.train_test_split(x,y,test_size=0.2)