Trying to use pandas to oversample my ragged data (data with different lengths). Given the following data samples: Data (groups are separated with — for convince): Targets: I would like to balance the minority class. In the sample above, target 1 is the minority class with 2 samples, for ids 1 & 3. I’m looking for a way to oversample
Tag: oversampling
Over and under sample multi-class training examples (rows) in a pandas dataframe to specified values
I would like to make a multi-class pandas dataframe more balanced for training. A simplified version of my training set looks as follows: Imbalanced dataframe: counts for class 0, 1 and 2 are respectively 7, 3 and 1 I made this with the code: Now I would like to randomly under sample the majority class(es) and randomly over sample the