The caret (Classification And REgression Training) package provides a consistent interface to over 200 predictive modeling algorithms in R. It wraps the training, tuning, and evaluation steps into a single workflow centered on the train() function.
What’s covered#
- Specifying the Model – formula,
x/y, and recipe interfaces totrain() - Preprocessing –
preProcoptions for centering, scaling, imputation, and filtering - Adding Options –
trainControl()for resampling and other settings - Resampling Options – k-fold CV, repeated CV, bootstrap, LGOCV, LOO, time-slice
- Performance Metrics –
summaryFunctionwithdefaultSummary,twoClassSummary,prSummary - Grid Search –
tuneGridwithexpand.grid()for explicit tuning parameter values - Random Search –
tuneLengthwithsearch = "random"intrainControl() - Subsampling –
samplingoption for class imbalance (down, up, SMOTE, ROSE) - Parallel Processing –
doMC(macOS/Linux) anddoParallel(Windows) via foreach
