Hi,
Could you please help me to understand WeightedRandomSampler ?
I have unbalanced dataset, where target is either 0 or 1. Number of zeroes is 1871, number of ones is 229.
Is it possible to generate new balanced dataset with WeightedRandomSampler,such that I have overall number of zeroes is for example 200 and ones is also 200.
in my code weights=[0.1,0.9]
sampler = torch.utils.data.sampler.WeightedRandomSampler(weights, 400,replacement=False)
but it doesn’t work, it gives error
RuntimeError: invalid argument 2: cannot sample n_sample > prob_dist.size(1) samples without replacement
I just want to include in my dataset all ones and only part of zeroes.
Thank you very much in advance!