Modeling evaluation and selection

As we've done in prior chapters, the first recommended task when utilizing caret functions is to build the object that specifies how model training is going to happen. This is done with the trainControl() function. We are going to create a five-fold cross-validation and save the final predictions (the probabilities). It is recommended that you also index the resamples so that each base model trains on the same folds. Also, notice in the function that I specified upsampling. Why? Well, notice that the ratio of "Yes" versus "No" is 2 to 1:

    > table(train$type)     No Yes     267 133

This ratio is not necessarily imbalanced, but I want to demonstrate something here. In many data sets, the outcome of interest is a ...

Get Mastering Machine Learning with R - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.