balanced_weighted_sampler#

(s3prl.dataio.sampler.balanced_weighted_sampler)

For datasets with highly unbalanced class

Authors:
  • Leo 2022

BalancedWeightedSampler#

class s3prl.dataio.sampler.balanced_weighted_sampler.BalancedWeightedSampler(labels: List[str], batch_size: int, duplicate: int = 1, seed: int = 12345678)[source][source]#

Bases: object

This batch sampler is always randomized, hence cannot be used for testing

set_epoch(epoch: int)[source][source]#