Deprecation warnings from sklearn

Biranchi picture Biranchi · Apr 9, 2017 · Viewed 15.7k times · Source

I am using cross_validation from sklearn,

from sklearn.cross_validation import train_test_split

I get the below warning:

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.

Answer

cjbrog picture cjbrog · Apr 9, 2017

Problem:

The deprecation warning means that the module is deprecated, i.e. no longer supported. You are using a version for which sklearn.cross_validation is not a module any longer.

Solution:

from sklearn.model_selection import train_test_split

C/O: This post.