IRIC is an R library for imbalanced classification, which will bring convenience to users by integrating a wide set of solutions into one library.
The current version of IRIC (v1.1) provides a set of 19 approaches for imbalanced classification, in which 8 approaches are new implementations in R. All these approaches can be classified into 3 strategies: data level, algorithm level and ensemble-based strategy. In addition, we provide parallel implementations of Bagging-based solution to improve the efficiency of model building. All approaches in IRIC are presented in the table below.
Strategy | Submodule | Method |
---|---|---|
Algorithm level | Cost-sensitive learning | CSC4.5 |
Data level | Oversampling | ADASYN, MWMOTE, Random Oversampling, SMOTE |
Undersampling | CLUS,Random Undersampling | |
Hybrid Sampling | SmoteENN, SmoteTL, SPIDER | |
Ensemble-based learning | BalanceBagging | RBBagging, ROSBagging,RUSBagging,SMOTEBagging |
BalanceBoost | AdaC2, RUSBoost, SMOTEBoost | |
Hybrid Ensemble | BalanceCascade, EasyEnsemble |
Download the code from GitHub repository before and then apply the techniques. R version >= 3.1.
SMOTE(Data level), CSC4.5 (Algorithm level) and RBBagging (Ensemble-based level) are presented as examples of IRIC's usage.
#Example of SMOTE
#Load the package caret for data partitioning
library(caret)
#Load data set
load("Korean.RDa")
#Run the script file of SMOTE
source("SMOTE.R")
#data split
sub <- createDataPartition(Korean$Churn,p=0.75,list=FALSE)
trainset <- Korean[sub,]
testset <- Korean[-sub,]
x <- trainset[, -11]
y <- trainset[, 11]
#call the SMOTE
newData<- SMOTE(x, y)
#Example of CSC4.5
#load CSC4.5
source("CSC45.R")
library(caret)
#Load data set
load("Korean.RDa")
#Data split
sub <- createDataPartition(Korean$Churn,p=0.75,list=FALSE)
trainset <- Korean[sub,]
testset <- Korean[-sub,]
x <- trainset[, -11]
y <- trainset[, 11]
#training model
model <- CSC45(x, y, pruning = TRUE)
#Prediction
output <- predict (model, x)
#Example of RBBagging
#Load the package caret for data partitioning
library (caret)
#Load data set
load(”Korean.RDa”)
#Run the script file of RBBagging
source(”BalanceBagging.R”)
#Data split
sub <- createDataPartition(Korean$Churn, p=0.75,list=FALSE)
trainset <- Korean[sub,]
testset <- Korean[-sub,]
x <- trainset[, -11]
y <- trainset[, 11]
#call the RBBaging for model training train
model <- bbagging(x, y, type=”RBBagging", allowParallel=TRUE)
#prediction
output <- predict (model, x)