Kfold,cross_val_score:根据显示的数据(sklearn包装器)?

时间:2019-09-25 14:18:34

标签: python cross-validation xgboost k-fold

我听不懂

的输出
kfold_results = cross_val_score(xg_cl, X_train, y_train, cv=kfold, scoring='roc_auc')

xgb.cv的输出很清晰-有训练和测试成绩:

[0] train-auc:0.927637+0.00405497   test-auc:0.788526+0.0152854
[1] train-auc:0.978419+0.0018253    test-auc:0.851634+0.0201297
[2] train-auc:0.985103+0.00191355   test-auc:0.86195+0.0164157
[3] train-auc:0.988391+0.000999448  test-auc:0.870363+0.0161025
[4] train-auc:0.991542+0.000756701  test-auc:0.881663+0.013579

但是Sk-learn包装器中cross_val_score的结果是模棱两可的:它是每次折叠后的得分列表,但是: -test_data或train_data的结果?

1 个答案:

答案 0 :(得分:1)

Kfold将数据从sklearnfolds数量中分离出来,数量为Changed in version 0.20: cv default value if None will change from 3-fold to 5-fold in v0.22.。因此,它将数据集分为5个子集(版本0.22的默认值),使用4作为训练,使用1作为验证。因此,输出为5个项目的数组,每个迭代1个。看起来像这样: enter image description here