ImportError: No module named model_selection

后端 未结 11 612
攒了一身酷
攒了一身酷 2021-01-30 08:16

I am trying to use train_test_split function and write:

from sklearn.model_selection import train_test_split

and this causes

11条回答
  •  心在旅途
    2021-01-30 08:50

    As @linusg said, one option is just import crossvalidation as follows:

    from sklearn import cross_validation
    X_train,X_test,y_train,y_test = cross_validation.train_test_split(X,y,test_size=0.3)
    

提交回复
热议问题