ubOver: Over-sampling

Description Usage Arguments Details Value See Also Examples

Description

The function replicates randomly some instances from the minority class in order to obtain a final dataset with the same number of instances from the two classes.

Usage

1
ubOver(X, Y, k = 0, verbose=TRUE)

Arguments

X

the input variables of the unbalanced dataset.

Y

the response variable of the unbalanced dataset. It must be a binary factor where the majority class is coded as 0 and the minority as 1.

k

defines the sampling method.

verbose

print extra information (TRUE/FALSE)

Details

If K=0: sample with replacement from the minority class until we have the same number of instances in each class. If K>0: sample with replacement from the minority class until we have k-times the orginal number of minority instances.

Value

The function returns a list:

X

input variables

Y

response variable

See Also

ubBalance

Examples

1
2
3
4
5
6
7
8
library(unbalanced)
data(ubIonosphere)
n<-ncol(ubIonosphere)
output<-ubIonosphere$Class
input<-ubIonosphere[ ,-n]

data<-ubOver(X=input, Y= output)
newData<-cbind(data$X, data$Y)

Example output

Loading required package: mlr
Loading required package: ParamHelpers
Loading required package: foreach
Loading required package: doParallel
Loading required package: iterators
Loading required package: parallel

unbalanced documentation built on May 2, 2019, 7:01 a.m.