简体   繁体   中英

Predictions using AUC metrics for multilabel classification

I'm using AUC metrics to do a multilabel classification. Since keras has removed prediction_classes for obtaining the prediction classes, I just use a threshold of 0.5 to get the output classes. However, as I understand, for AUC the threshold should not be 0.5 for an imbalanced data set. How can I get the threshold that was used for training the model?

Besides, I know that AUC is used for binary classification. 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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM