How to use F1 score and Accuracy for binary classification? #1087
Unanswered
aedoardo
asked this question in
Classification
Replies: 1 comment
-
And where do you call the metrics? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I'm having some doubts about a task that I'm facing. I'm doing an image binary classification and I have a question about the metrics.
In my task I have two classes that I defined as 0 and 1. Initially, I used the torchmetrics modules with the
num_classes
parameter equals to2
and I saw that myF1 score
and myAccuracy
are always the same while theRecall
is slightly different and theaverage
is always themacro
. The datasets that I'm using are balanced between the two classes.Now, I changed the metrics' code in this way:
and even in this case I have always the same
Accuracy
and the sameF1 Score
.I'm confused about the
num_classes
parameter: which one should I use for a binary classification? The first, withnum_classes=2
or the second one withnum_classes=1
? And why I'm having always the same value for the F1 and the Accuracy even if I'm using the average macro? Is it due to the balanced dataset?Just another information: in the training (and validation) step what I do is the following:
and then I simply pass the output to the metrics with
y
as targets.Thank you, have a nice day!
Beta Was this translation helpful? Give feedback.
All reactions