classification for task='multiclass',num_classes=2 vs task='binary'
#3140
-
|
When I calculate acc, f1, recall, etc. using function parameters (task='class', num_classes=2), all the metrics obtained are equal, while the metrics obtained using parameters (task='binary ') are different. Is this a bug |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
When When |
Beta Was this translation helpful? Give feedback.
When
num_classes=2is used withtask='multiclass', metrics like accuracy, F1, and recall are computed in a macro-averaged multiclass way — each class is treated separately, and results are averaged. In a perfectly balanced binary dataset with symmetric performance, these macro-averaged values can end up identical across metrics.When
task='binary', metrics use positive-class-focused definitions (e.g., precision/recall relative to the positive label only), which often produces different numbers. This isn’t a bug — it’s due to the difference between binary vs macro‑multiclass computation strategies