【发布时间】:2020-11-07 15:01:25
【问题描述】:
我正在使用随机森林进行 5 折交叉验证:
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import cross_validate
forest = RandomForestClassifier(n_estimators=100, max_depth=8, max_features=6)
cv_results = cross_validate(forest, X, y, cv=5, scoring=scoring)
但是,我想在一张图上绘制 5 个输出的 ROC 曲线。该文档仅提供了一个示例,用于在专门使用 StratifiedKFold 交叉验证时绘制具有交叉验证的 roc 曲线(请参阅此处的文档:https://scikit-learn.org/stable/auto_examples/model_selection/plot_roc_crossval.html#sphx-glr-auto-examples-model-selection-plot-roc-crossval-py)
我尝试 tweeking 代码以使其适用于 cross_validate 但无济于事。
如何制作一条 ROC 曲线,将 cross_validate 输出的 5 个结果绘制在单个图表上?
提前致谢
【问题讨论】:
-
请不要交叉发布问题...stats.stackexchange.com/questions/477667/…
-
scoring你用什么?
标签: matplotlib machine-learning scikit-learn roc