liveBook · Manning

Confusion matrix

As explained in Machine Learning Algorithms in Depth

A confusion matrix is a table counting predictions by combinations of predicted and actual classes.

A confusion matrix counts binary-classification outcomes by comparing predicted and actual labels. Matching labels produce true positives or true negatives; mismatches produce false positives or false negatives. section 5.2

Read the four cells as:

  • True positive (TP) and true negative (TN): correct predictions. section 5.2
  • False positive (FP) and false negative (FN): incorrect predictions. section 5.2
  • Changing the classification threshold changes all four counts. section 5.2

Perceptron evaluation

A perceptron classifier can be evaluated with a confusion matrix on the iris dataset; Python code imports scikit-learn's confusion_matrix utility.

How Machine Learning Algorithms in Depth covers it

How deep it goes
Defines four outcome counts and connects threshold changes to ROC and precision-recall curves, without deriving matrix internals.
Examples
Uses perceptron predictions on the iris dataset and a scikit-learn confusion-matrix utility.
What it assumes
Assumes binary predictions and ground-truth labels while defining the four prediction outcomes directly.
What you can do after
Evaluate classifier predictions by identifying TP, TN, FP, and FN and relating them to threshold-based metrics.
How it connects
Connects binary classification with classification thresholds, true positive rate, false positive rate, ROC curves, and precision-recall curves.

Also explained in

Compare how 14 books explain confusion matrix →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning Algorithms in Depth. The section links point to the parts of the book it draws on.