Is there any built-in method to oversample minority classes?

@tcapelle I’m getting this error. Could you point out what I’m doing wrong?

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-59-03316aa7729a> in <module>()
----> 1 sampler = ImbalancedDatasetSampler(learner.data.train_ds,num_samples=20)

<ipython-input-28-22c469eed6da> in __init__(self, dataset, indices, num_samples)
 14         for idx in self.indices:
 15             label = self._get_label(dataset, idx)
---> 16             for l in label:
 17                 if l in label_to_count:
 18                     label_to_count[l] += 1

TypeError: 'int' object is not iterable
1 Like