Member-only story

Interview question: What is a confusion matrix in machine learning?

Crystal X
2 min readOct 12, 2023

--

Any individual entering the field of data science and machine learning will need to have a clear understanding of what a confusion matrix is because they are used in supervised classification problems.

In the field of machine learning and specifically the problem of statistical classification, a confusion matrix, also known as error matrix, is a specific table layout that allows visualisation of the performance of an algorithm, typically a supervised learning classification problem.

Each row of the matrix represents the instances in an actual class while each column represents the instances in a predicted class, or vice versa.

The confusion matrix is a special kind of contingency table, with two dimensions (“actual” and “predicted”), and identical sets of “classes” in both dimensions (each combination of dimension and class is a variable in the contingency table).

The diagram below is a depiction of a confusion matrix for a binary classification problem:-

  1. True positive is when the actual and predicted values are positive.
  2. True negative are when the actual and predicted values are negative.
  3. False positive is when the actual value is negative but the predicted value is positive

--

--

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