python - 分层KFold输出处理

标签 python machine-learning scikit-learn cross-validation

我有一个包含 20 行和 60 列的系列,即 20 个示例,每个示例有 60 个参数。

kfold = StratifiedKFold(y=encoded_Y, n_folds=10, shuffle=True, random_state=seed) The output consists of two columns

我想知道第二列是什么意思,它是根据什么选择这两个索引的。为什么不采用三个索引?

Furthur,我想知道交叉验证函数如何将这个系列作为“cv”参数的输入。 “cv”一般为整数。

结果= cross_val_score(估计器,X,encoded_Y,cv = kfold)

最佳答案

sklearn.cross_validation 中的所有交叉验证器一样这是索引对的迭代器。在每对中,第一项是训练索引列表,第二项是测试索引列表。

the example you bring第一项包含一对,其中除 1, 17 之外的所有内容都是训练索引,而 1, 17 是测试索引。

关于python - 分层KFold输出处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38539780/

相关文章:

python - Scikit-learn SVM 数字识别

python - 学习 : Mean Distance from Centroid of each cluster

python - 如何避免此编码挑战中的运行时错误?

python - 当我将符号添加到具有 textVariable 的标签时

Python的argparse从几个可选参数中选择一个

algorithm - 机器学习的 'predictive'元素是什么

python - 如何分析sklearn中tfidf矩阵的值?

制作一个可以接受可迭代或任意数量参数的函数的 Pythonic 方法?

machine-learning - 神经网络 : What does the input layer consist of?

image-processing - 图像的颜色直方图