使用 GridsearchCV () 进行保留验证

Kha*_*han 5 python scikit-learn hyperparameters grid-search

GridsearchCV()有一个参数cv,默认值为3,表示是3倍。有没有办法将 Gridsearch() 与保留验证方案一起使用。例如80-20%分割???

vum*_*sha 3

您可以使用sklearn.model_selection.ShuffleSplitor sklearn.model_selection.StratifiedShuffleSplitwithn_splits=1代替 cv 参数

阅读文档了解更多详细信息 http://scikit-learn.org/stable/modules/ generated/sklearn.model_selection.StratifiedShuffleSplit.html#sklearn.model_selection.StratifiedShuffleSplit