简体   繁体   English

使用 AUC 指标进行多标签分类的预测

[英]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.

相关问题 使用知识蒸馏 model 运行预测并检查分类指标 - Using a Knowledge Distillation model to run predictions and check classification metrics Sklearn的roc_auc_score用于多标签二进制分类 - Sklearn's roc_auc_score for multilabel binary classification 使用tensorflow进行多标签分类验证 - Multilabel classification validation using tensorflow 使用TensorFlow进行多标签文本分类 - Multilabel Text Classification using TensorFlow 使用 BERT 和 Tensorflow 的多标签文本分类 2 - Multilabel text classification using BERT and Tensorflow 2 Scikit使用核心外学习多标签分类 - Scikit Learn Multilabel Classification Using Out Of Core 使用条件随机场的多标签分类 - MultiLabel Classification using Conditional Random Field 使用预取数据集进行多标签分类的混淆矩阵 - confusion matrix for multilabel classification using prefetch dataset 错误:分类指标无法处理多类多输出和多标记指标目标的混合 - Error: Classification metrics can't handle a mix of multiclass-multioutput and multilabel-indicator targets 如何修复 ValueError:分类指标无法处理模型的多类和多标签指标目标的混合? - How to fix ValueError: Classification metrics can't handle a mix of multiclass and multilabel-indicator targets for model?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM