roc_auc_score中的pred_y參數用法
想請教專家
roc_auc_score(y_true, y_scores)
一般指的y_scores其實就是pred_y嗎?
我在網路上google到有文章說
**使用 roc_auc_score 來評估 **這邊特別注意 y_pred 必須要放機率值進去,而不是轉換過的1或0**
但也有文章說可以放入1或0,想請教那一個才是正確的觀念呢??
回答列表
-
2020/01/07 上午 01:07Jeffrey贊同數:0不贊同數:0留言數:0
y_scores其實就是pred_y:是的。另外,面積計算的確是兩種方式都有人用,取決於你如何去解釋這個結果。
-
2020/01/20 下午 03:58張維元 (WeiYuan)贊同數:0不贊同數:0留言數:0
可以看一下文件:https://scikit-learn.org/stable/modules/generated/sklearn.metrics.roc_auc_score.html
y_scorearray-like of shape (n_samples,) or (n_samples, n_classes)
Target scores. In the binary and multilabel cases, these can be either probability estimates or non-thresholded decision values (as returned by
decision_function
on some classifiers). In the multiclass case, these must be probability estimates which sum to 1. The binary case expects a shape (n_samples,), and the scores must be the scores of the class with the greater label. The multiclass and multilabel cases expect a shape (n_samples, n_classes). In the multiclass case, the order of the class scores must correspond to the order oflabels
, if provided, or else to the numerical or lexicographical order of the labels iny_true
.看起來是要用 機率值 才是符合 sklearn 的設計。