Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)
like image 425
javac Avatar asked Apr 07 '26 22:04

javac


2 Answers

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.

like image 99
seralouk Avatar answered Apr 11 '26 02:04

seralouk


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)
like image 31
babita kumari Avatar answered Apr 11 '26 00:04

babita kumari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!