1.ImportError: cannot import name cross_validation
solution & answer:
This happens because there is no cross_validation object in sklearn. You're likely looking for something more like the cross_validate function. You can access that through
from sklearn.model_selection import cross_validate
2.
AttributeError: 'function' object has no attribute 'train_test_split'
solution & answer :
train_test_split is a separate module (docs), and it is not to be used in combination with cross_validate; the correct usage here is (assuming scikit-learn v0.20):
from sklearn.model_selection import train_test_split
#X_train, X_test, y_train, y_test=train_test_split(X,y,test_size=0.2)
1万+




被折叠的 条评论
为什么被折叠?



