Member-only story

How to calculate classification metrics using a confusion matrix

Crystal X
4 min readMar 2, 2023

--

There are two main types of models in supervised machine learning, being classification and regression. In the classification model, the confusion matrix is essential to determine the goodness of fit of the model.

A confusion matrix is a table used in machine learning to evaluate the performance of a classification model. It summarises the results of the model’s predictions on a set of data, comparing its predictions to the true labels of the data.

The confusion matrix is organised into rows and columns, with each row representing the instances in a predicted class, and each column representing the instances in an actual (true) class. The table is filled with four values:

  1. True Positive (TP): the model correctly predicted that an instance belongs to the positive class.
  2. False Positive (FP): the model incorrectly predicted that an instance belongs to the positive class when it actually belongs to the negative class.
  3. True Negative (TN): the model correctly predicted that an instance belongs to the negative class.
  4. False Negative (FN): the model incorrectly predicted that an instance belongs to the negative class when it actually belongs to the positive class.

--

--

Crystal X
Crystal X

Written by Crystal X

I have over five decades experience in the world of work, being in fast food, the military, business, non-profits, and the healthcare sector.

No responses yet