Get startedGet started for free

Make a custom trainControl

The wine quality dataset was a regression problem, but now you are looking at a classification problem. This is a simulated dataset based on the "don't overfit" competition on Kaggle a number of years ago.

Classification problems are a little more complicated than regression problems because you have to provide a custom summaryFunction to the train() function to use the AUC metric to rank your models. Start by making a custom trainControl, as you did in the previous chapter. Be sure to set classProbs = TRUE, otherwise the twoClassSummary for summaryFunction will break.

This exercise is part of the course

Machine Learning with caret in R

View Course

Exercise instructions

Make a custom trainControl called myControl for classification using the trainControl function.

  • Use 10 CV folds.
  • Use twoClassSummary for the summaryFunction.
  • Be sure to set classProbs = TRUE.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create custom trainControl: myControl
myControl <- trainControl(
  method = "cv", 
  number = ___,
  summaryFunction = ___,
  classProbs = ___, # IMPORTANT!
  verboseIter = TRUE
)
Edit and Run Code