ImportError: No module named model_selection

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

    Adding some info to the previous answer from @linusg :

    sklearn keeps a release history of all its changes. Think of checking it from time to time. Here is the link to the documentation.

    As you can see in the documentation for the version 0.18, a new module was created called model_selection. Therefore it didn't exist in previous versions.

    Update sklearn and it will work !

提交回复
热议问题