How to track a progress while building model with the caret package? How to track a progress while building model with the caret package? r r

How to track a progress while building model with the caret package?


Assuming that you are training the model with

  • an expanded grid of tuning parameters (all combinations of the tuning parameters)
  • and a resampling technique of your choice (cross validation, bootstrap etc)

You could set

trainctrl <- trainControl(verboseIter = TRUE)

and set it in the trControl argument of the train function to track the training progress

model <- train(training$class ~ .,data=training, method = 'nb', trControl = trainctrl)

This prints out the progress out to the console at each resampling stage, and allows you to gauge the progress of the training/parameter tuning.

To estimate the total running time, you could run the model once to see how long it runs, and estimate the total time by multiplying accordingly based on your resampling scheme and number of parameter combinations. This can be done by setting the trainControl again, and setting the tuneLength to 1:

trainctrl <- trainControl(method = 'none')model <- train(training$class ~ ., data = training, method = 'nb', trControl = trainctrl, tuneLength = 1)

Hope this helps! :)