The weights
argument should contain weights for each sample, not just the class weights.
Have a look at this example.
-
Usually you would pass
num_samples = len(dataset)
, but you could also vary the number of samples from yourDataLoader
, if that’s your use case. -
With
replacement = True
each drawn sample can be drawn again. On the other hand,replacement = False
still uses the weights associated with each sample, but removes a drawn sample from the set.