View source: R/SOptim_DataBalancing.R
balanceMulticlassData | R Documentation |
A simple function to perform data balancing for multi-class datasets and classification problems. It does over-sampling (or sampling with replacement) if the frequency value of the target class is below n and down-sampling (or sampling without replacement) if the frequency is above n.
balanceMulticlassData(x, class, n)
x |
A data frame to balance. |
class |
The name or the position of the column identifying the class (the column must be a factor variable). |
n |
Number of rows/observations to extract from each class? (integer) |
A data.frame with n rows by class.
This function is just a rough fix for handling unbalanced datasets, use with care!...
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.