Evaluation Metrics with caret

Overview

Teaching: 40 min
Exercises: 0 min
Questions
  • How do we measure the accuracy of ML model

Objectives
  • Learn different metrics with caret

4 Evaluation Metrics

4.1 Regression model Evaluation Metrics

4.1.1 Correlation Coefficient (R) or Coefficient of Determination (R2):

image

cor(prediction,testing)
cor.test(prediction,testing)

4.1.2 Root Mean Square Error (RMSE) or Mean Square Error (MSE)

image

The postResample function gives RMSE, R2 and MAE at the same time:

postResample(prediction,testing$Ozone)

4.2. Classification model Evaluation Metrics

4.2.1 Confusion Matrix

For binary output (classification problem with only 2 output type, also most popular):

image

 confusionMatrix(predict,testing)

Key Points

  • Caret