adabag boosting function throws error when giving mfinal>10

Abdul Khader picture Abdul Khader · Apr 21, 2013 · Viewed 11.2k times · Source

I have a strange issue, whenever I try increasing the mfinal argument in boosting function of adabag package beyond 10 I get an error, Even with mfinal=9 I get warnings.

My train data has 7 class Dependant variable and 100 independant variables and around 22000 samples of data(Smoted one class using DMwR). My Dependant Variable is at the end of the training dataset in sequence.

library(adabag)
gc()
exp_recog_boo <- boosting(V1 ~ .,data=train_dataS,boos=TRUE,mfinal=9)

Error in 1:nrow(object$splits) : argument of length 0
In addition: Warning messages:
1: In acum + acum1 :
longer object length is not a multiple of shorter object length

Thanks in advance.

Answer

Jos&#233; Luis Delgado picture José Luis Delgado · Jun 29, 2016

My mistake was that I didn't set the TARGET as factor before.

Try this:

train$target <- as.factor(train$target)

and check by doing:

str(train$TARGET)