scikit-learn中的随机分层k折交叉验证? [英] Randomized stratified k-fold cross-validation in scikit-learn?

查看:441
本文介绍了scikit-learn中的随机分层k折交叉验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何内置方法可以使scikit-learn执行随机分层k折交叉验证?这是最常见的CV方法之一,但令我惊讶的是我找不到内置的方法来实现此目的.

Is there any built-in way to get scikit-learn to perform shuffled stratified k-fold cross-validation? This is one of the most common CV methods, and I am surprised I couldn't find a built-in method to do this.

我看到cross_validation.KFold()有一个改组标志,但没有分层.不幸的是cross_validation.StratifiedKFold()没有这样的选择,cross_validation.StratifiedShuffleSplit()不会产生不相交的折叠.

I saw that cross_validation.KFold() has a shuffling flag, but it is not stratified. Unfortunately cross_validation.StratifiedKFold() does not have such an option, and cross_validation.StratifiedShuffleSplit() does not produce disjoint folds.

我错过了什么吗?这是计划好的吗?

Am I missing something? Is this planned?

(显然我可以自己实现)

(obviously I can implement this by myself)

推荐答案

在当前版本0.15中引入了cross_validation.StratifiedKFold的改组标志:

The shuffling flag for cross_validation.StratifiedKFold has been introduced in the current version 0.15:

http://scikit-learn.org/0.15/modules/generation/sklearn.cross_validation.StratifiedKFold.html

这可以在变更日志中找到:

This can be found in the Changelog:

http://scikit-learn.org/stable/whats_new.html#新功能

cross_validation.StratifiedKFold的随机播放选项.杰弗里(Jeffrey) 布莱克本.

Shuffle option for cross_validation.StratifiedKFold. By Jeffrey Blackburne.

这篇关于scikit-learn中的随机分层k折交叉验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆