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.2) 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 |
R version >= 3.5
library(devtools)
devtools::install_github('reneroliveira/IRIC')
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
data(Korean)
#data split
sub <- createDataPartition(Korean$Churn,p=0.75,list=FALSE)
trainset <- Korean[sub,]
testset <- Korean[-sub,]
#call the SMOTE
newData<- SMOTE(Churn~., trainset)
#Example of CSC4.5
library(caret)
#Load data set
data(Korean)
#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
data(Korean)
#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)