Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with naive_bayes.py #23

Open
rcampos0 opened this issue Apr 2, 2022 · 1 comment
Open

error with naive_bayes.py #23

rcampos0 opened this issue Apr 2, 2022 · 1 comment

Comments

@rcampos0
Copy link

rcampos0 commented Apr 2, 2022

I'm using pycharm, and when running the program, it sends the following error message: "ImportError: cannot import name 'cross_validation' from 'sklearn' "
Which command replaced the cross_validation function?

@Fairlizz
Copy link

You can replace it with "from sklearn.model_selection import train_test_split" instead of "from sklearn import cross_validation".
So you can immediately use it here:
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=5)
Instead of:
X_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y, test_size=0.25, random_state=5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants