python的train_test_split的stratify
时间: 2023-10-13 16:03:50 浏览: 95
python中split()方法
在Python中,train_test_split函数的参数stratify用于指定将数据集划分为训练集和测试集时,根据指定的目标变量(y)的分类值进行分层采样。使用stratify参数可以确保训练集和测试集中的分类值的比例与原始数据集中的比例相同。这有助于确保训练集和测试集中的样本具有相似的分布,从而更好地评估模型的性能。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [sklearn train_test_split 中stratify参数解析](https://blog.csdn.net/csdnypp/article/details/126462241)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [exoplanet_exploration_machine_learning:机器学习算法,可从所有观察到的开普勒“感兴趣对象”的累积记录...](https://download.csdn.net/download/weixin_42120550/15355693)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文