ImportError: No module named model_selection

后端 未结 11 597
攒了一身酷
攒了一身酷 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:41

    In Late September 2016, SciKit Learn 0.18 was released and there was a slight change to the code. With SciKit Learn 0.18 the train_test_split function is now imported from model_selection instead of cross_validation.

    from sklearn.cross_validation import train_test_split
    

    has been changed to :

    from sklearn.model_selection import train_test_split
    

    The same has also happened for GridSearchCV.

提交回复
热议问题