I don’t know, but you could use this code as a small example to see how a WeightedRandomSampler
is used to create balanced batches for a binary use case.
You should pass the sampler to the DataLoader
using the corresponding targets.
I.e. if the sampler used the training targets to calculate its weights, it should be used together with the training dataset in the training DataLoader
.