Create data loader with balanced class sampling.
Ensures equal representation of all classes in each batch.
- Parameters:
dataset (Dataset) – Dataset with ‘targets’ or ‘labels’ attribute
batch_size (int) – Batch size
num_workers (int) – Number of workers
pin_memory (bool) – Whether to pin memory
- Return type:
DataLoader
- Returns:
DataLoader with balanced sampling