now before applying weighted loss function for each class, I want to know does it make any sense to use class weight when dataset is this much unbalanced ? Specially when my batch_size=1.
(I can’t increase batch_size because of my system resources).
are there any other approaches I can use in that case ?
If you are using a batch size of 1, the loss weighting won’t have any effect in the default setup using reduction='mean', since the weighted mean will be calculated.
Here is a small example showing this behavior: