简体   繁体   中英

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 .

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.

Now cross_validation has been deprecated and model_selection is used instead, However all the methods and classes remains the same. 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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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