Confusion Matrix and Classification Report

Understanding two powerful techniques to evaluate a classification model.

Giulio Laurenti, PhD
The Startup

--

Classification is the task of assigning an observation to a category based on specific criteria.

In machine learning, classification is part of supervised learning, which means that the data used to train the model have labels that identify each category.

A critical step in the life cycle of a machine learning model is the evaluation of its performance.

Two techniques used to evaluate a classification model are the confusion matrix and the classification report.

In this post, we will learn to interpret the confusion matrix and the classification report while using them to evaluate the performance of a Support Vector Machine model on two common types of classification problems:

  • Binary classification
  • Multiclass classification

Let’s import all the necessary libraries in Python.

# Libraries for data manipulation and visualization
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Libraries and modules for Machine Learning
from sklearn.svm import SVC
from sklearn.model_selection import…

--

--

Giulio Laurenti, PhD
The Startup

A Molecular Biologist who enjoys writing about programming, science, and the wonderful world around us.