liveBook · Manning

Confusion matrix

A confusion matrix is a table that cross-tabulates actual and predicted classes to summarize classification outcomes.

How 14 Manning books explain it

Starting Data Analytics with Generative AI and Python

A confusion matrix is a table comparing actual classes with predicted classes to summarize classification outcomes.

How it is used
Checks review-score predictions and keyword-based positive-review extraction by exposing classification outcomes beyond an overall accuracy figure.
How deep it goes
Works through a five-class output and a binary count-based calculation, without developing a general mathematical treatment.
Examples
Uses a five-score customer-review prediction matrix and a positive-review keyword search checked against scores of 4 or 5.
What you can do after
Apply it via scikit-learn or Python counts to inspect prediction mistakes and calculate sensitivity and specificity.

Read how Starting Data Analytics with Generative AI and Python explains confusion matrix →

Grokking Machine Learning

A tabular representation of classification outcomes divided into true-positive, true-negative, false-positive, and false-negative counts.

How it is used
Evaluates classification models by making their correct predictions and error types visible.
How deep it goes
Defines binary matrix layout and error counts, then extends the layout to multiclass classification.
Examples
Uses medical diagnosis, spam detection, and animal-image classes to illustrate classification outcomes.
What you can do after
Evaluate classification models by counting correct predictions and distinguishing false positives from false negatives.

Read how Grokking Machine Learning explains confusion matrix →

Statistics Slam Dunk

A confusion matrix is a table that cross-classifies predicted and observed classes to count correct and incorrect classifications.

How it is used
Evaluates binary classification performance after logistic-regression predictions are converted into class labels.
How deep it goes
Explains four outcome types, requires binary inputs, and derives sensitivity, specificity, error, and accuracy.
Examples
Uses NBA playoff predictions, a 0.50 probability cutoff, R's table() function, and an 80-observation classification result.
What you can do after
Diagnose model performance with R by constructing a confusion matrix and calculating key classification measures.

Read how Statistics Slam Dunk explains confusion matrix →

Statistics Every Programmer Needs

A confusion matrix is a table that summarizes classification results by cross-tabulating actual classes against predicted classes.

How it is used
Evaluates classification models by exposing class-specific successes and errors beyond a single accuracy score.
How deep it goes
Defines binary cells, demonstrates pandas and scikit-learn construction, and derives sensitivity, specificity, accuracy, and error rates.
Examples
Uses Turkish raisin classification and fourth-down conversion prediction, with pandas, scikit-learn, and explicit cell counts.
What you can do after
Diagnose classification behavior by calculating error types and comparing performance across classes.

Read how Statistics Every Programmer Needs explains confusion matrix →

Knowledge Graphs and LLMs in Action

A confusion matrix is a tabular summary of predicted and actual class assignments, including counts of correct and incorrect classifications.

How it is used
Uses class-level error counts to evaluate GNN node classification and link prediction beyond aggregate metrics.
How deep it goes
Explains correct and incorrect class assignments through concrete counts and model comparisons, without deriving matrix metrics mathematically.
Examples
Compares GCN, GAT, and SAGE on licit–illicit nodes and predicted user–movie rating links.
What you can do after
Diagnose model behavior by locating class-specific misclassifications and weighing missed positives against false alarms.

Read how Knowledge Graphs and LLMs in Action explains confusion matrix →

Natural Language Processing in Action, Second Edition

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

How it is used
Diagnoses classification performance by exposing correct predictions, false positives, and false negatives.
How deep it goes
Explains error categories, visual interpretation, and recall through a worked binary-classification result.
Examples
Uses toxic-comment predictions, a numeric matrix, and a scikit-learn Matplotlib display.
What you can do after
Diagnose model mistakes with scikit-learn counts and visual displays, then interpret recall for the toxic class.

Read how Natural Language Processing in Action, Second Edition explains confusion matrix →

Grokking Statistics

A confusion matrix is a table that cross-tabulates predicted classes against actual classes and counts correct and incorrect classifications.

How it is used
Evaluates classification performance by separating correct predictions, false alarms, and missed positive cases.
How deep it goes
Defines four matrix cells and interprets imbalance, then connects them to precision and recall without covering other negative-focused measures.
Examples
Uses a wolf-detection alarm tested over 100 days and a later evaluation involving more wolves across 500 days.
What you can do after
Evaluate classification results by identifying correct predictions, false alarms, missed cases, and accuracy failures caused by imbalance.

Read how Grokking Statistics explains confusion matrix →

Machine Learning Algorithms in Depth

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

How it is used
Evaluates binary classifiers by organizing correct and incorrect predictions against ground-truth labels.
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 you can do after
Evaluate classifier predictions by identifying TP, TN, FP, and FN and relating them to threshold-based metrics.

Read how Machine Learning Algorithms in Depth explains confusion matrix →

Graph Algorithms for Data Science

A confusion matrix is a table counting classification outcomes by actual class and predicted class.

How it is used
Evaluates node-classification predictions by comparing actual and predicted language classes.
How deep it goes
Defines the comparison and visualizes normalized results, stopping short of explaining the matrix’s underlying computation.
Examples
Uses stream-language predictions, an unbalanced test set, and English-versus-other-language errors.
What you can do after
Diagnose/debug with it, identify which language classes a classifier confuses and whether errors concentrate between particular classes.

Read how Graph Algorithms for Data Science explains confusion matrix →

Data-Driven Cybersecurity

A confusion matrix is a table that cross-classifies predicted classes against actual classes to show correct and incorrect classification outcomes.

How it is used
Evaluates classification performance by showing correct predictions and the types of errors across classes.
How deep it goes
Defines row and column orientation and interprets diagonal and off-diagonal cells, including the risk of missed threats.
Examples
Uses high- and low-risk cybersecurity articles and normal-versus-threat network traffic as classification examples.
What you can do after
Evaluate classifier errors by identifying correct predictions, false alarms, and missed threats.

Read how Data-Driven Cybersecurity explains confusion matrix →

Effective Conversational AI

A confusion matrix is a tabular summary comparing a classifier's predicted categories with the authoritative categories for evaluation examples.

How it is used
Diagnoses problematic intent-classification patterns so recall, precision, and F1 improvements can target specific errors.
How deep it goes
Defines four outcomes and works through recall, precision, and F1 calculations using an intent-level evaluation example.
Examples
Uses Request_Agent utterances such as “Speak with an agent,” “What can I ask you,” and “Somebody hit my car.”
What you can do after
Diagnose over-selection and under-selection by interpreting prediction outcomes and calculating intent-level evaluation metrics.

Read how Effective Conversational AI explains confusion matrix →

Deep Learning with PyTorch, Second Edition

A 2D breakdown of classification outcomes into true/false positives/negatives used to analyze model predictions.

How it is used
Measures classification quality when accuracy obscures failures on an imbalanced dataset.
How deep it goes
Defines four outcome quadrants through labels and thresholds, then stops short of detailed metric formulas.
Examples
Uses lung-nodule classification and a guard-dog scenario involving burglars, harmless animals, and barking thresholds.
What you can do after
Evaluate classification errors by separating correct predictions from false alarms and missed positive cases.

Read how Deep Learning with PyTorch, Second Edition explains confusion matrix →

First-Party Data Activation

A confusion matrix is a table that organizes the counts or shares of correct and incorrect outcomes for a classification system.

How it is used
Frames identity-resolution sampling results and supports decisions about matching thresholds and strategies.
How deep it goes
Explains all four outcomes and their business, analytical, customer, and regulatory consequences.
Examples
Uses identity-resolution sampling tests and a shared-household IP attribution scenario.
What you can do after
Evaluate identity-resolution risks and choose thresholds that balance false positives against false negatives.

Read how First-Party Data Activation explains confusion matrix →

Financial AI in Practice

A table that summarizes classification results by comparing predicted classes with actual classes.

How it is used
Evaluates fraud-classification predictions against actual labels on an unseen, imbalanced test set.
How deep it goes
Defines four outcome categories and presents the matrix as one output in a broader quantitative test-set evaluation.
Examples
Uses fraud detection results, including 127 of 148 frauds identified and 456 legitimate transactions flagged incorrectly.
What you can do after
Evaluate fraud detection by distinguishing correctly identified transactions from false alarms and missed fraud.

Read how Financial AI in Practice explains confusion matrix →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.