Abdul Basit
Abdul Basit

Reputation: 11

How should I fix this DeprecationWarning?

%matplotlib notebook

import numpy as np
 import matplotlib.pyplot as plt
 import pandas as pd
 from sklearn.cross_validation import train_test_split

The Warning

/home/abdul/anaconda3/lib/python3.6/site-packages/sklearn/cross_validation.py:41: 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)

I am using jupytor notebook and on the above lines of code. DeprecationWarning occurs so how can I fix that?

Upvotes: 1

Views: 1855

Answers (1)

Chathuranga Chandrasekara
Chathuranga Chandrasekara

Reputation: 20906

Deprecation means the module is marked as outdated or deprecated so there will not be any official maintenance beyond a certain point at the time. (In this case version 0.20). You have to fix this in your code if you are planning to upgrade beyond this point.

In your partucular case, instead of,

from sklearn.cross_validation import train_test_split

you can use,

from sklearn.model_selection import train_test_split

Upvotes: 1

Related Questions