liveBook · Manning

Confusion matrix

As explained in 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.

A confusion matrix tabulates correct and incorrect predictions for each class, making model behavior more specific than overall precision, recall, or F1-score. It is especially useful when errors affect classes differently, such as licit versus illicit nodes or predicted user–movie links. section 12.1.5 section 12.2.5

Read the matrix by separating:

  • Correct predictions for each class, including true positives and true negatives. section 12.2.5
  • Incorrect predictions, including false positives and false negatives. section 12.1.5 section 12.2.5
  • Class-specific trade-offs: missing illicit nodes differs operationally from incorrectly flagging licit nodes, just as missed ratings differ from irrelevant recommendations. section 12.1.5 section 12.2.5

Comparing GNN link predictors

For user–movie link prediction, SAGE records 19,084 true negatives, 7,211 true positives, 2,872 false negatives, and 1,082 false positives. The matrix shows strong filtering of unlikely movies, but also reveals missed potential ratings. section 12.2.5

Figure 12.6 Confusion matrices to understand the performance of GCN, GAT, and SAGE models on each class (licit or illicit)
figure

Compare class-level confusion matrices for GCN, GAT, and SAGE on licit and illicit node classification. section 12.1.5

Figure 12.11 Confusion matrices of GCN, GAT, and SAGE models on the testing dataset
figure

Inspect testing-dataset confusion matrices for GCN, GAT, and SAGE link prediction. section 12.2.5

How Knowledge Graphs and LLMs in Action covers it

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 it assumes
Assumes familiarity with precision, recall, F1-score, and binary class predictions from GNN evaluation.
What you can do after
Diagnose model behavior by locating class-specific misclassifications and weighing missed positives against false alarms.
How it connects
Connects confusion matrices with precision, recall, F1-score, node classification, and link prediction.

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 Knowledge Graphs and LLMs in Action. The section links point to the parts of the book it draws on.