← all repositories

ufoym/imbalanced-dataset-sampler

A PyTorch sampler that rebalances class distributions by oversampling minority classes and undersampling majority ones during training.

2.3k stars Python ML FrameworksData Tooling
imbalanced-dataset-sampler
Velocity · 7d
+0.8
★ / day
Trend
steady
star history

This repository provides an ImbalancedDatasetSampler for PyTorch that automatically estimates sampling weights to counter class imbalance without requiring a new balanced dataset. It helps prevent model bias toward over-represented classes by adjusting how samples are drawn from the training data. When combined with data augmentation, it also helps mitigate overfitting from naive duplication strategies.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.