Skip to content
This repository has been archived by the owner on Feb 24, 2022. It is now read-only.

Use train_test_split under sklearn.model_selection #384

Closed
wants to merge 1 commit into from
Closed

Use train_test_split under sklearn.model_selection #384

wants to merge 1 commit into from

Conversation

MichelML
Copy link
Contributor

recent versions (at least >=0.20.x) of sklearn have train_test_split under the module model_selection and not cross_validation

link: https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html

stacktrace I got when running the notebook:

-----------------------------------
ModuleNotFoundErrorTraceback (most recent call last)
<ipython-input-34-ce9dd2d5e4df> in <module>
      1 # Import train_test_split
----> 2 from sklearn.cross_validation import train_test_split
      3 
      4 # Split the 'features' and 'income' data into training and testing sets
      5 X_train, X_test, y_train, y_test = train_test_split(features_final, 

ModuleNotFoundError: No module named 'sklearn.cross_validation'

recent versions (at least >=0.20.x) of sklearn have train_test_split under the module `model_selection` and not `cross_validation`  

link: https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html

stacktrace I got when running the notebook:

```
-----------------------------------
ModuleNotFoundErrorTraceback (most recent call last)
<ipython-input-34-ce9dd2d5e4df> in <module>
      1 # Import train_test_split
----> 2 from sklearn.cross_validation import train_test_split
      3 
      4 # Split the 'features' and 'income' data into training and testing sets
      5 X_train, X_test, y_train, y_test = train_test_split(features_final, 

ModuleNotFoundError: No module named 'sklearn.cross_validation'
```
@MichelML MichelML changed the title use train_test_split under sklearn.model_selection Use train_test_split under sklearn.model_selection Mar 13, 2019
@ronny-udacity
Copy link
Contributor

sklearn >= "0.20.0"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants