Show me a DeprecationWarning when trying to use cross_validation

1

Currently when executing the CrossValidation and GridSearch module, it shows me this error:

C:\Program Files\Anaconda2\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:\Program Files\Anaconda2\lib\site-packages\sklearn\grid_search.py:43: 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. This module will be removed in 0.20.
DeprecationWarning)

Why is it? and How do I solve it?

    
asked by Ambigus9 02.04.2017 в 23:10
source

1 answer

3

It is a 'deprecation warning', that means that cross_validation will be eliminated in future versions of the library and will no longer have support, specifically in Scikit-learn v0.20 it will no longer be available. It is a warning so you do not use it for this reason, if you use it and use your code with versions equal to or greater than 0.20, your script will not be valid. In practice you can ignore this warning and continue to use the module while not updating to version 0.20.

The message itself tells you to consider using the model_selection module instead, in which it is assumed that there will be substitute methods from those found in the previous module. You just have to change the import properly, just as an example:

 from sklearn.cross_validation import train_test_split 

by:

from sklearn.model_selection import train_test_split 

I leave the link to the official documentation where the content is detailed of the model_selection module, here you can see the functions and classes it contains.

    
answered by 02.04.2017 / 23:42
source