Stratified Train/Validation/Test-split in scikit-learn

前端 未结 2 2151
深忆病人
深忆病人 2021-02-15 14:51

There is already a description here of how to do stratified train/test split in scikit via train_test_split (Stratified Train/Test-split in scikit-learn) and a description of ho

2条回答
  •  被撕碎了的回忆
    2021-02-15 15:24

    Yes, this is exactly how I would do it - running train_test_split() twice. Think of the first as splitting off your training set, and then that training set may get divided into different folds or holdouts down the line.

    In fact, if you end up testing your model using a scikit model that includes built-in cross-validation, you may not even have to explicitly run train_test_split() again. Same if you use the (very handy!) model_selection.cross_val_score function.

提交回复
热议问题