R/imbalance.R
oversample.Rd
Wrapper that encapsulates a collection of algorithms to perform a class balancing preprocessing task for binary class datasets
oversample( dataset, ratio = NA, method = c("RACOG", "wRACOG", "PDFOS", "RWO", "ADASYN", "ANSMOTE", "SMOTE", "MWMOTE", "BLSMOTE", "DBSMOTE", "SLMOTE", "RSLSMOTE"), filtering = FALSE, classAttr = "Class", wrapper = c("KNN", "C5.0"), ... )
dataset | A binary class |
---|---|
ratio | Number between 0 and 1 indicating the desired ratio between
minority examples and majority ones, that is, the quotient size of
minority class/size of majority class. There are methods, such as
|
method | A |
filtering | Logical (TRUE or FALSE) indicating wheter to apply filtering
of oversampled instances with |
classAttr |
|
wrapper | A |
... | Further arguments to apply in selected method |
A balanced data.frame
with same structure as dataset
,
containing both original instances and new ones
#> [1] 0.4861111# 0.4861111 newDataset <- oversample(glass0, ratio = 0.8, method = "MWMOTE") imbalanceRatio(newDataset)#> [1] 0.8055556newDataset <- oversample(glass0, method = "ADASYN") newDataset <- oversample(glass0, ratio = 0.8, method = "SMOTE")