rwo: Random walk oversampling

Description Usage Arguments Details Value References Examples

View source: R/rwo.R

Description

Generates synthetic minority examples for a dataset trying to preserve the variance and mean of the minority class. Works on every type of dataset.

Usage

1
rwo(dataset, numInstances, classAttr = "Class")

Arguments

dataset

data.frame to treat. All columns, except classAttr one, have to be numeric or coercible to numeric.

numInstances

Integer. Number of new minority examples to generate.

classAttr

character. Indicates the class attribute from dataset. Must exist in it.

Details

Generates numInstances new minority examples for dataset, adding to the each numeric column of the j-th example its variance scalated by the inverse of the number of minority examples and a factor following a N(0,1) distribution which depends on the example. When the column is nominal, it uses a roulette scheme.

Value

A data.frame with the same structure as dataset, containing the generated synthetic examples.

References

Zhang, Huaxiang; Li, Mingfang. Rwo-Sampling: A Random Walk Over-Sampling Approach To Imbalanced Data Classification. Information Fusion 20 (2014), p. 99<e2><80><93>116.

Examples

1
2
3
data(iris0)

newSamples <- rwo(iris0, numInstances = 100, classAttr = "Class")

ncordon/imbalance documentation built on Feb. 19, 2018, 7:08 a.m.