Inferensys

Glossary

Confusion Matrix

A confusion matrix is a table used to evaluate the performance of a classification model by summarizing true positives, false positives, true negatives, and false negatives.
ML engineer running AI model benchmarks, performance charts on multiple screens, late night home office setup.
PERFORMANCE EVALUATION

What is a Confusion Matrix?

A confusion matrix is a fundamental tool for evaluating the performance of a classification model, particularly in tasks like entity resolution.

A confusion matrix is a tabular summary used to visualize the performance of a classification algorithm by comparing its predicted labels against the true, ground-truth labels. It categorizes outcomes into four core cells: True Positives (TP), True Negatives (TN), False Positives (FP), and False Negatives (FN). This structure provides a complete picture of correct classifications and error types, forming the basis for all standard classification metrics like precision, recall, and F1-score.

In entity resolution, the matrix evaluates a model's ability to correctly link records representing the same entity (positives) and distinguish records representing different entities (negatives). A false positive is an incorrect match (two different records linked), while a false negative is a missed match (two records for the same entity not linked). Analyzing the matrix's distribution helps data engineers tune the trade-off between precision (minimizing false matches) and recall (minimizing missed matches) for their specific use case.

PERFORMANCE METRICS

Components of a Confusion Matrix

This table defines the four core cells of a confusion matrix and their derived performance metrics, which are used to evaluate classification models in entity resolution.

ComponentDefinitionEntity Resolution ContextDerived Metric

True Positive (TP)

The model correctly predicts the positive class. Records are correctly linked as the same entity.

Two records that refer to the same real-world person are correctly matched by the entity resolution system.

Recall, Precision

False Positive (FP)

The model incorrectly predicts the positive class. Records are incorrectly linked as the same entity.

Two records that refer to different people are incorrectly matched by the system (a false link).

Precision, False Discovery Rate

True Negative (TN)

The model correctly predicts the negative class. Records are correctly identified as different entities.

Two records that refer to different people are correctly left unmatched by the system.

Specificity, Negative Predictive Value

False Negative (FN)

The model incorrectly predicts the negative class. Records that are the same entity are incorrectly left unlinked.

Two records that refer to the same person are not matched by the system (a missed link).

Recall, False Omission Rate

Precision

The proportion of predicted matches that are correct. TP / (TP + FP).

Measures the accuracy of the links the system creates. A high precision means few false links.

Recall (Sensitivity)

The proportion of actual matches that are found. TP / (TP + FN).

Measures the system's ability to find all true matches. A high recall means few missed links.

F1-Score

The harmonic mean of precision and recall. 2 * (Precision * Recall) / (Precision + Recall).

A single metric that balances the trade-off between precision and recall.

Specificity

The proportion of actual non-matches correctly identified. TN / (TN + FP).

Measures the system's ability to correctly reject non-matching record pairs.

EVALUATION METRICS

Key Metrics Derived from a Confusion Matrix

A confusion matrix provides the raw counts of a classification model's predictions. These core counts are used to calculate the fundamental metrics that quantify the model's accuracy, error types, and overall performance.

01

Accuracy

Accuracy is the proportion of total predictions that the model got correct. It is calculated as (True Positives + True Negatives) / Total Predictions.

  • Use Case: Provides a high-level overview of model performance when the class distribution is balanced.
  • Limitation: Can be misleading for imbalanced datasets. For example, a model that always predicts the majority class in a dataset with 95% negative examples will have 95% accuracy but fails completely on the positive class.
  • Formula: (TP + TN) / (TP + TN + FP + FN)
02

Precision

Precision (or Positive Predictive Value) measures the model's exactness when it makes a positive prediction. It answers: "Of all the records the model labeled as a match, what fraction were actually matches?"

  • Focus: Quality of positive predictions. High precision means the model's matches are trustworthy.
  • Critical For: Entity resolution tasks where a false match (merging two different entities) has high downstream costs, such as in customer data integration or financial compliance.
  • Formula: TP / (TP + FP)
03

Recall

Recall (or Sensitivity, True Positive Rate) measures the model's completeness in finding all actual positives. It answers: "Of all the true matches that exist, what fraction did the model successfully retrieve?"

  • Focus: Coverage of the positive class. High recall means the model misses few true matches.
  • Critical For: Tasks where missing a true match is costly, such as fraud detection (missing a fraudulent transaction) or medical diagnosis.
  • Formula: TP / (TP + FN)
04

F1 Score

The F1 Score is the harmonic mean of Precision and Recall. It provides a single metric that balances the trade-off between them.

  • Use Case: The preferred metric when you need a single number to compare models, especially with imbalanced class distributions. It penalizes models that are strong in one metric (e.g., high precision) but weak in the other (e.g., low recall).
  • Interpretation: An F1 score of 1 represents perfect precision and recall, while 0 represents the worst.
  • Formula: 2 * (Precision * Recall) / (Precision + Recall)
05

Specificity & False Positive Rate

Specificity (True Negative Rate) measures the proportion of actual negatives correctly identified. False Positive Rate (FPR) is its complement (1 - Specificity).

  • Specificity: Answers "Of all the true non-matches, what fraction did the model correctly leave unlinked?" Crucial for understanding how well the model avoids creating false links.
  • False Positive Rate: The probability that a true negative is incorrectly classified as positive. This is critical for evaluating the operational burden of a system—a high FPR means many record pairs require manual review.
  • Formulas:
    • Specificity: TN / (TN + FP)
    • FPR: FP / (FP + TN)
06

ROC-AUC & Precision-Recall AUC

ROC-AUC (Receiver Operating Characteristic - Area Under Curve) evaluates the model's performance across all classification thresholds. It plots the True Positive Rate (Recall) against the False Positive Rate.

  • ROC-AUC Interpretation: A value of 0.5 indicates a random classifier; 1.0 indicates a perfect classifier. Useful for comparing models on balanced datasets.

Precision-Recall AUC plots Precision against Recall and is often more informative for imbalanced datasets common in entity resolution (where true matches are rare). It focuses directly on the performance of the positive class.

EVALUATION METRIC

Application in Entity Resolution

A confusion matrix is a fundamental tool for evaluating the classification performance of an entity resolution system, quantifying its successes and errors in linking records.

In entity resolution, a confusion matrix is a 2x2 table that categorizes the outcomes of a pairwise matching decision between two records. It counts True Positives (TP), correctly linked matches; False Positives (FP), incorrectly linked non-matches; True Negatives (TN), correctly separated non-matches; and False Negatives (FN), missed matches. This structured breakdown is the basis for calculating core performance metrics like precision and recall, which trade off linkage accuracy against completeness.

The matrix provides actionable diagnostics beyond aggregate scores. A high FP rate indicates an overly permissive model creating false merges, while a high FN rate suggests a conservative model missing valid links. Analyzing these cells guides the tuning of similarity thresholds, blocking strategies, and feature engineering. For probabilistic and machine learning-based resolution systems, the confusion matrix is essential for model validation and for estimating the Fellegi-Sunter model parameters that define match and non-match probabilities.

CONFUSION MATRIX

Frequently Asked Questions

A confusion matrix is the fundamental diagnostic tool for evaluating classification models, including those used in entity resolution. This table provides a granular breakdown of prediction outcomes, enabling precise calculation of performance metrics.

A confusion matrix is a tabular layout used to visualize the performance of a classification algorithm by comparing its predicted labels against the true, ground-truth labels. It works by categorizing every prediction into one of four core outcomes for a binary classification problem: True Positives (TP), False Positives (FP), True Negatives (TN), and False Negatives (FN). The rows typically represent the actual class, while the columns represent the predicted class. By counting instances into these cells, the matrix provides a complete picture of where the model succeeds and where it makes errors, forming the basis for all subsequent performance metrics like accuracy, precision, and recall.

For example, in an entity resolution task to identify duplicate customer records, a 'match' is the positive class. A True Positive is correctly identifying two records as belonging to the same person. A False Positive is incorrectly linking two different people's records (a false match). A True Negative is correctly determining two records are different people. A False Negative is failing to link two records that are actually the same person (a missed match).

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.