YuanGongND / ast

Code for the Interspeech 2021 paper "AST: Audio Spectrogram Transformer".
BSD 3-Clause "New" or "Revised" License
1.06k stars 202 forks source link

why not mean of class-wise accuracy ? #71

Closed liyunlongaaa closed 2 years ago

liyunlongaaa commented 2 years ago
# best model on the validation set
stats, _ = validate(audio_model, val_loader, args, 'valid_set')
# note it is NOT mean of class-wise accuracy
val_acc = stats[0]['acc']                                           
val_mAUC = np.mean([stat['auc'] for stat in stats])

for val_acc = stats[0]['acc'] ,I can't understand why only the accuracy of the first class is taken, can this also explain the problem, will it be more convincing to choose the mean of all classes?

YuanGongND commented 2 years ago

Hi there,

As commented above the line, accuracy is not a class-wise metric (i.e., it is not a one vs all accuracy). All classes have the same accuracy value, so taking the mean should lead to the same value.

https://github.com/YuanGongND/ast/blob/87a80043154eb4bb34ebceb4dc3e2d91a99235f4/src/utilities/stats.py#L26

-Yuan

liyunlongaaa commented 2 years ago

oh I see, thank you!