close

[Solved] ImportError: cannot import name ‘cross_validation’ from ‘sklearn’

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error ImportError: cannot import name ‘cross_validation’ from ‘sklearn’ in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ImportError: cannot import name ‘cross_validation’ from ‘sklearn’ Error Occurs?

Today I get the following error ImportError: cannot import name ‘cross_validation’ from ‘sklearn’ in python.

How To Solve ImportError: cannot import name ‘cross_validation’ from ‘sklearn’ Error ?

  1. How To Solve ImportError: cannot import name 'cross_validation' from 'sklearn' Error ?

    To Solve ImportError: cannot import name 'cross_validation' from 'sklearn' Error cross_validation is deprecated since version 0.18. This module will be removed in 0.20.

  2. ImportError: cannot import name 'cross_validation' from 'sklearn'

    To Solve ImportError: cannot import name 'cross_validation' from 'sklearn' Error cross_validation is deprecated since version 0.18. This module will be removed in 0.20.

Solution 1

cross_validation is deprecated since version 0.18. This module will be removed in 0.20.

Use sklearn.model_selection.train_test_split instead.

from sklearn.model_selection import train_test_split

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read