powered by
Balance class distributions by randomly replicating minority examples or by generating synthetic samples with a local SMOTE implementation.
bal_oversampling(attribute, method = c("smote", "random"), k = 5, seed = NULL)
returns an object of class bal_oversampling
bal_oversampling
target class attribute name
oversampling strategy: "smote" or "random"
"smote"
"random"
number of nearest neighbors used by the SMOTE strategy
optional random seed for reproducibility
Chawla, N. V., Bowyer, K. W., Hall, L. O., & Kegelmeyer, W. P. (2002). SMOTE: Synthetic Minority Over-sampling Technique.
data(iris) iris_imb <- iris[c(1:50, 51:71, 101:111), ] bal <- bal_oversampling("Species", method = "smote", seed = 123) iris_bal <- transform(bal, iris_imb) table(iris_bal$Species)
Run the code above in your browser using DataLab