sklearn中K折交叉验证中每个折叠的预测值 [英] Predicted values of each fold in K-Fold Cross Validation in sklearn
本文介绍了sklearn中K折交叉验证中每个折叠的预测值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经使用python sklearn对数据集执行了10倍交叉验证,
I have performed 10-fold cross validation on a dataset that I have using python sklearn,
result = cross_val_score(best_svr,X, y,cv = 10,scoring ='r2')
print(result.mean())
我已经能够以获得r2分数的平均值作为最终结果。我想知道是否有一种方法可以打印出每折的预测值(在这种情况下为10组值)。
I have been able to get the mean value of the r2 score as the final result. I want to know if there is a way to print out the predicted values for each fold( in this case 10 sets of values).
推荐答案
我相信您正在寻找 cross_val_predict
函数。
I believe you are looking for the cross_val_predict
function.
这篇关于sklearn中K折交叉验证中每个折叠的预测值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文