Learn R Programming

hyperSMURF (version 2.0)

smote: SMOTE oversampling

Description

Function to oversample by SMOTE the minority class

Usage

smote(data, fp = 1, k = 5)

Arguments

data

data frame or matrix of data including only the minority class. Rows: examples; columns: features

fp

multiplicative factor for the SMOTE oversampling of the minority class (def=1). If fp<1 no oversampling is performed.

k

number of the nearest neighbours for SMOTE oversampling (def. 5)

Value

a data frame including the original minority class examples plus the SMOTE oversampled data

Details

If n is the number of examples of the minority class, then fp*n new synthetic examples are generated according to the SMOTE algorithm and returned in addition to the original set of positives. If fp<1 no new data are generated and the original data set is returned

See Also

smote_and_undersample

Examples

Run this code
# NOT RUN {
d <- imbalanced.data.generator(n.pos=20, n.neg=1000, n.features=12, n.inf.features=2, sd=1, seed=1);
res <- smote(d$data[d$label==1,],  fp = 2, k = 3);
# }

Run the code above in your browser using DataLab