title: Weighted random sampler - oversample or undersample?
body: <h2>Problem</h2>
  <p>I am training a deep learning model in PyTorch for binary classification, and I have a dataset containing unbalanced class proportions. My minority class makes up about <code>10%</code> of the given observations. To avoid the model learning to just predict the majority class, I want to use the <code>WeightedRandomSampler</code> from <code>torch.utils.data</code> in my <code>DataLoader</code>.</p>
  <p>Let's say I have <code>1000</code> observations (<code>900</code> in class <code>0</code>, <code>100</code> in class <code>1</code>), and a batch size of <code>100</code> for my dataloader.</p>
  <p>Without weighted random sampling, I would expect each training epoch to consist of 10 batches.</p>
  <h2>Questions</h2>
  <ul>
  <li>Will only 10 batches be sampled per epoch when using this sampler - and consequently, would the model 'miss' a large portion of the majority class during each epoch, since the minority class is now overrepresented in the training batches?</li>
  <li>Will using the sampler result in more than 10 batches being sampled per epoch (meaning the same minority class observations may appear many times, and also that training would slow down)?</li>
  </ul>