[英]Predictions using AUC metrics for multilabel classification
I'm using AUC metrics to do a multilabel classification.我正在使用 AUC 指标进行多标签分类。 Since keras has removed prediction_classes for obtaining the prediction classes, I just use a threshold of 0.5 to get the output classes.由于 keras 已经删除了 prediction_classes 以获得预测类,所以我只使用 0.5 的阈值来获得 output 类。 However, as I understand, for AUC the threshold should not be 0.5 for an imbalanced data set.但是,据我了解,对于不平衡的数据集,AUC 的阈值不应为 0.5。 How can I get the threshold that was used for training the model?如何获得用于训练 model 的阈值?
Besides, I know that AUC is used for binary classification.此外,我知道 AUC 用于二进制分类。 Can I just use it for multilabel problem?我可以将它用于多标签问题吗? How to calculate the threshold?如何计算阈值? By taking the average or not.通过取平均值与否。
You can use AUC for the multi-label problem, check this .您可以将AUC用于多标签问题, 请查看 。
import numpy as np
y_true = np.random.randint(0,2,(100,4))
y_pred = np.random.randint(0,2,(100,4))
m = tf.keras.metrics.AUC(multi_label=True, thresholds=[0, 0.5])
m(y_true, y_pred).numpy()
FYI, from tf 2.5
, it now supports logit predictions.仅供参考,从tf 2.5
开始,它现在支持 logit 预测。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.