module 'sklearn' has no attribute 'cross_validation'
Try this:
from sklearn.model_selection import train_test_split
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.33, random_state=101)
you can try this
X_train,X_test,Y_train,Y_test =
sklearn.model_selection.train_test_split(X,boston_df.price)
sklearn
does not automatically import its subpackages. If you only imported via: import sklearn
, then it won't work. Import with import sklearn.cross_validation
instead.
Further, sklearn.cross_validation
will be deprecated in version 0.20. Use sklearn.model_selection.train_test_split
instead.