python - scikit-learn:plot_roc_curve 以管道作为估计器
问题描述
有没有办法使用带有管道的 plot_roc_curve 作为估计器?我是说:
plot_roc_curve(pipeline, X_test, y_test)
解决方案
使用 scikit-learn 0.22,它就像一个魅力。
from sklearn.datasets import load_breast_cancer
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline
from sklearn.metrics import plot_roc_curve
X, y = load_breast_cancer(return_X_y=True)
pipe = make_pipeline(StandardScaler(), LogisticRegression())
pipe.fit(X, y)
plot_roc_curve(pipe, X, y)
推荐阅读
- logstash - Logstash 没有将数据推送到 elasticsearch
- azure - 如何为我的新 Azure Active Directory 域获取邮箱?
- powerbi - Power BI Embedded 是否支持交叉报表钻取?
- javascript - 将片段 Jquery 转换为 JS
- javascript - 复选框:如果选中复选框,则启用按钮
- elasticsearch - Filebeat 日期字段映射为类型关键字
- excel - 从一个表列复制到另一列时,PasteSpecial 失败
- python - Interactive Brokers (IB) Python API:无法在 VS Code 上运行 IB 教程示例
- python - 无法掌握:在 python 中制作一个简单的单例(对于 mongodb 管理器)
- php - 使用带有 PDF 附件的 AWS SESClient yii2 发送邮件时出现问题