问题
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)
回答1:
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.
回答2:
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)
来源:https://stackoverflow.com/questions/45009249/python-machine-learning-deprecationwarning