How to get a non-shuffled train_test_split in sklearn

后端 未结 3 538
野性不改
野性不改 2021-01-04 00:27

If I want a random train/test split, I use the sklearn helper function:

In [1]: from sklearn.model_selection import train_test_split
   ...: train_test_split         


        
3条回答
  •  情书的邮戳
    2021-01-04 01:09

    All you need to do is to set the shuffle parameter to False and stratify parameter to None:

        In [49]: train_test_split([1,2,3,4,5,6],shuffle = False, stratify = None)
        Out[49]: [[1, 2, 3, 4], [5, 6]]
    

提交回复
热议问题