简体   繁体   English

python机器学习DeprecationWarning

[英]python machine learning DeprecationWarning

Please could you help me to solve this?请问你能帮我解决这个问题吗?

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)

The

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)

is just a deprecation warning .只是一个弃用警告


No need to worry but keep in mind that cross_val will be removed in 0.20 .不用担心,但请记住cross_val将在0.20中删除。

This error is just to warn you that the developers are going to move this function before they do it.这个错误只是警告你,开发人员将在他们这样做之前移动这个功能。


Just an example.In the future we will have to replace:只是一个例子。将来我们将不得不更换:

from sklearn.cross_validation import KFold

with:和:

 from sklearn.model_selection import KFold

For the second error that I can see in the screenshot that you posted, the SA3L module seems not to be installed.对于我在您发布的屏幕截图中看到的第二个错误,似乎未安装SA3L module

Now cross_validation has been deprecated and model_selection is used instead, However all the methods and classes remains the same.现在 cross_validation 已被弃用,取而代之的是 model_selection,但是所有方法和类都保持不变。 You just have to now import:您现在只需导入:

from sklearn import model_selection

and for training and testing the data you have to do something like this:为了训练和测试数据,你必须这样做:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM