View source: R/trans_sample_oversampling.R
| bal_oversampling | R Documentation |
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)
attribute |
target class attribute name |
method |
oversampling strategy: |
k |
number of nearest neighbors used by the SMOTE strategy |
returns an object of class bal_oversampling
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")
iris_bal <- transform(bal, iris_imb)
table(iris_bal$Species)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.