0
$\begingroup$

I've got a CNN (resnet18), performing binary classification. The final layer is fully connected with 2 nodes. The loss function is CrossEntropyLoss (pytorch).

When I switch the labels of the classes (in the sense that True becomes False and False becomes True), the metrics report large differences. What are possible reasons for this? Shouldn't this be symmetrical (given that the initialization is fixed)?

Class 0 = True, Class 1 = False

Epoch 4/4
----------
train Loss: 0.4624 Acc: 0.8204, Pre: 0.8580, Rec: 0.9030, F1: 0.8800
val Loss: 0.3144 Acc: 0.8318, Pre: 0.8058, Rec: 0.9643, F1: 0.8779

Training complete in 3m 50s
Best val F1: 0.939148

Class 0 = False, Class 1 = True

Epoch 4/4
----------
train Loss: 0.4815 Acc: 0.8173, Pre: 0.6888, Rec: 0.5924, F1: 0.6370
val Loss: 0.3174 Acc: 0.9066, Pre: 0.7461, Rec: 0.8607, F1: 0.7993

Training complete in 3m 26s
Best val F1: 0.799337
```
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.