MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Machine Learning with caret in R

Lihat Kursus

Petunjuk latihan

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.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

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