ROS | R Documentation |
A balanced dataset would be return by using random over-sampling (ROS) algorithm.
ROS(data, outcome, perc_maj = 100)
data |
A dataset containing the predictors and the outcome. The predictors
can be continuous ( |
outcome |
The column number or the name of the outcome variable in the dataset. |
perc_maj |
The desired percentage of the size of majority samples that the minority samples would be reached in the new dataset. The default is 100. |
The random over-sampling algorithm generates new samples by randomly sampling the minority samples with replacement according to the sample size of majority class, in order to get a more balanced dataset.
A new dataset has been balanced.
data(abalone)
table(abalone$Class)
newdata1 <- ROS(abalone, 'Class')
table(newdata1$Class)
newdata2 <- ROS(abalone, 'Class', perc_maj=50)
table(newdata2$Class)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.