1
$\begingroup$

I am just curious about the running output of R caret train function.

I am doing a grid search for a random forest model. Here is the code:

predCount <- ncol(dfTrain) - 1
rfGrid <- expand.grid(
  #mtry = round( predCount * c(0.75, 0.5, 0.33, 0.1) )
  mtry = round( predCount * c(0.33) )
)

rfTrControl <- trainControl(
  method = "cv",
  number = 5,
  verboseIter = TRUE,
  returnData = FALSE,
  allowParallel = TRUE
)

rfTrain <- train(
  x = as.matrix(dfTrain[, ! names(dfTrain) %in% c("totalRet")]), 
  y = dfTrain$totalRet,
  trControl = rfTrControl,
  tuneGrid = rfGrid,
  method = "rf",
  ntree = 1500
)

Here is the output:

+ Fold1: mtry=10 
- Fold1: mtry=10 
+ Fold2: mtry=10 
- Fold2: mtry=10 
+ Fold3: mtry=10 
- Fold3: mtry=10 
+ Fold4: mtry=10 
- Fold4: mtry=10 
+ Fold5: mtry=10 
- Fold5: mtry=10 
Aggregating results
...

Why are the folds printed twice? What do the + and - before each fold denote?

$\endgroup$
1
  • 1
    $\begingroup$ Wish StackExchange platform becomes mature enough to identify where a particular question belongs. They got another site now called datascience.stackexchange.com - why do they need two different sites for similar disciplines? They figured out tags long time back, so why they need different sites for different topics? :-( $\endgroup$ – arun Aug 16 '16 at 17:33
3
$\begingroup$

This is because for any fold, there are two stages: training and testing. For example, you are running 10 fold. Fold 1 training would print a plus sign and take a longer time. Fold 1 testing will print a minus sign and take shorter time.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks for answering, despite the question getting marked as "off-topic". $\endgroup$ – arun Aug 16 '16 at 17:34

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