4
$\begingroup$

when using caret packge in the trainControl you can use "smote" sampling. what is the default parameters the train in caret are using for smote??

parameters such as: perc.over = 300, k = 8, perc.under = 100..

ctrl <- trainControl(method = "repeatedcv",
                     number = 10,
                     repeats = 10, 
                     search = "grid", 
                     returnData = TRUE,
                     returnResamp = "final",
                     savePredictions = "all",
                     classProbs = TRUE,
                     sampling = "smote",
                     summaryFunction = twoClassSummary,
                     selectionFunction = "best",
                     allowParallel = TRUE)
$\endgroup$
2
$\begingroup$

I reproduced the example of https://topepo.github.io/caret/subsampling-for-class-imbalances.html and tried another one. Results are:

perc.over = 200

perc.under = 200

It seems that the parameters are those of usage of the function SMOTE in the DMwR documentation (pag. 82):

Usage

SMOTE(form, data, perc.over = 200, k = 5, perc.under = 200, learner = NULL, ...)

In usage k = 5, but I verified only perc.over and perc.under:

library(caret)
library(DMwR)

set.seed(2969)
imbal_train <- twoClassSim(10000, intercept = -20, linearVars = 20)
table(imbal_train\$Class)

set.seed(9560)
smote_train <- SMOTE(Class ~ ., data  = imbal_train)                         
table(smote_train\$Class)[2]

perc.over <- 100*(table(smote_train\$Class)[2]-table(imbal_train\$Class)[2])/table(imbal_train\$Class)[2]
perc.under <- 100*table(smote_train\$Class)[1]/(table(smote_train\$Class)[2]-table(imbal_train\$Class)[2])

perc.over = 200

perc.under = 200

set.seed(1234)
imbal_train <- twoClassSim(10000, intercept = -40, linearVars = 40)
table(imbal_train\$Class)

set.seed(5678)
smote_train <- SMOTE(Class ~ ., data  = imbal_train)                         
table(smote_train\$Class)

perc.over <- 100*(table(smote_train\$Class)[2]-table(imbal_train\$Class)[2])/table(imbal_train$Class)[2]
perc.under <- 100*table(smote_train\$Class)[1]/(table(smote_train\$Class)[2]-table(imbal_train\$Class)[2])

perc.over = 200

perc.under = 200

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.