ptrblck:

I assume the rows of your confusion matrix are your predictions and the columns the ground truth? If so, you can just divide the diagonal by the sum over the columns to get the per class accuracies. Then just calculate the mean and you’ll have a metric to optimize.


Rows are ground truths and cols are predictions. The mean per class accuracy metric you suggested would be in range 0-1. Do I use MSE loss layer, with 1 as the target always?
Something like this,
d = np.diag(confMat)
s = np.sum(confMat,1)
l = np.mean(d/(s+1)) #(s+1) to avoid 0 in denominator
loss = F.MSELoss(l, 1)
Would this help improve per class accuracy?



 ptrblck:

Are you able to apply some data augmentation on your input? Maybe a small amount of random noise on the features?


Nope. I quickly tried SMOTE from sklearn. Haven’t explored the results yet!