BalancedSample.Rd
This function samples the rows of a data.frame
with balanced classes.
Useful when original training set has severely unbalanced classes.
BalancedSample(df, sample_size = 5000, class_col = class_col)
df | An object of class |
---|---|
sample_size | Numeric. Size of the sample from each class. |
class_col | A character vector with the name of the column that identify the classes. |
Returns a data.frame
with n=sample_size
rows per class
randomly sampled.