error with naive_bayes.py
rcampos0 opened this issue · 1 comments
rcampos0 commented
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 commented
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)