Create a resamples object
Now that you have fit two models to the churn dataset, it's time to compare their out-of-sample predictions and choose which one is the best model for your dataset.
You can compare models in caret using the resamples() function, provided they have the same training data and use the same trainControl object with preset cross-validation folds. resamples() takes as input a list of models and can be used to compare dozens of models at once (though in this case you are only comparing two models).
Cet exercice fait partie du cours
Machine Learning with caret in R
Instructions
model_glmnet and model_rf are loaded in your workspace.
- Create a
list()containing theglmnetmodel asitem1and therangermodel asitem2. - Pass this list to the
resamples()function and save the resulting object asresamples. - Summarize the results by calling
summary()onresamples.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Create model_list
model_list <- list(item1 = ___, item2 = ___)
# Pass model_list to resamples(): resamples
# Summarize the results