Lesson Introduction

Classification metrics help us evaluate model performance on classification tasks like predicting spam emails or diagnosing diseases. They help us determine if our model performs well.

By the end, you'll understand:

  • Confusion Matrix and its interpretation.
  • Accuracy, Precision, and Recall.
  • F1-score
  • How to compute these metrics using Python and SciKit Learn.

Let's dive in!

Confusion Matrix

A Confusion Matrix describes the performance of a classification model. In the context of a confusion matrix, a positive prediction is predicting the class labeled 1, and a negative prediction is predicting the class labeled 0. The confusion matrix is a 2x2 table (for binary classification) that shows:

  • True Positives (TP): A number of the correct positive predictions.
  • True Negatives (TN): A number of the correct negative predictions.
  • False Positives (FP): A number of the incorrect positive predictions.
  • False Negatives (FN): A number of the incorrect negative predictions.

Imagine that you need to classify emails as spam (1) or not-spam (0). Let's define an example of predictions and then create our confusion matrix:

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal