I am experiencing an issue with a model I am trying to run using Caret package. It is working absolutely fine using naive Bayes function directly:
category_model <- naiveBayes(Y ~ X1 + X2 + X3, data=train_category)
predict <- predict(category_model,test_category, type = 'class')
and then using the confusion matrix to look the accuracy result.
But when I try to do the same with caret applying cross-validation:
cv_3_folds <- createMultiFolds(train_label, k = 3, times = 3)
ctrl_3 <- trainControl(method = "repeatedcv", number = 3, repeats = 3, index = cv_3_folds)
naivebayes_cv3 <- train(Y~ X1 + X2,
data=train_category,
method = "nb",
trControl = ctrl_3)
It gives me this issue: Cannot allocate vector of size 21 Go. This does not make sense this my dataset is only 500 Mo.
Its working fine with the first function so I am guessing it comes from the caret package but I don't know exactly where.
Anyone can help me on this? Thanks. M.