Inferensys

Glossary

Confusion Matrix

A tabular layout visualizing the performance of a classification algorithm by displaying the counts of correct and incorrect predictions for each actual modulation class.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
PERFORMANCE VISUALIZATION

What is a Confusion Matrix?

A confusion matrix is a specific table layout that allows visualization of the performance of a supervised learning algorithm, typically a classifier, by displaying the counts of correct and incorrect predictions broken down by each actual class.

A confusion matrix is a tabular visualization of a classification model's performance where each row represents the instances in an actual class, and each column represents the instances in a predicted class. The diagonal elements count correct classifications, while off-diagonal elements reveal specific misclassification patterns between different modulation types.

For automatic modulation classification, the matrix quantifies how often a QPSK signal is mistaken for 16QAM versus BPSK, providing granular error analysis beyond simple accuracy. Derived metrics like precision, recall, and F1-score are computed directly from the matrix's true positives, false positives, and false negatives to evaluate classifier robustness under varying signal-to-noise ratios.

PERFORMANCE QUANTIFICATION

Key Metrics Derived from the Confusion Matrix

The confusion matrix is a raw tabulation of predictions versus actual classes. The following scalar metrics are derived from its cell counts to provide a concise, objective assessment of a modulation classifier's performance.

01

Accuracy

The most intuitive metric, representing the ratio of correct predictions to the total number of predictions. It is calculated as (TP + TN) / (TP + TN + FP + FN). While useful for balanced datasets, accuracy can be highly misleading in scenarios with class imbalance, such as when one modulation scheme dominates the spectrum. A high accuracy score might simply reflect the classifier's ability to guess the majority class.

Misleading
On Imbalanced Data
02

Precision (Positive Predictive Value)

Precision answers: Of all signals classified as a specific modulation, how many actually were that modulation? It is the ratio of True Positives (TP) to the sum of True Positives and False Positives (TP + FP). High precision is critical in electronic warfare or spectrum enforcement, where a false positive (misidentifying a friendly signal as a threat, or a legal signal as illegal) triggers costly, incorrect actions.

TP / (TP + FP)
Formula
03

Recall (Sensitivity or True Positive Rate)

Recall answers: Of all actual signals of a given modulation, how many did the classifier correctly identify? It is the ratio of True Positives (TP) to the sum of True Positives and False Negatives (TP + FN). High recall is vital in signal intelligence (SIGINT), where missing an instance of a target signal (a false negative) means a complete failure to detect a potentially critical transmission.

TP / (TP + FN)
Formula
04

F1 Score

The harmonic mean of Precision and Recall, providing a single balanced metric that penalizes extreme trade-offs. Calculated as 2 * (Precision * Recall) / (Precision + Recall). The F1 score is the preferred metric when you seek a balance between avoiding false alarms (Precision) and missing real signals (Recall), and it is especially robust on datasets with uneven class distributions.

Harmonic Mean
Of P and R
05

Specificity (True Negative Rate)

Specificity answers: Of all signals that are NOT a target modulation, how many were correctly rejected? It is the ratio of True Negatives (TN) to the sum of True Negatives and False Positives (TN + FP). In spectrum monitoring, high specificity ensures that the classifier does not constantly raise false alarms by incorrectly labeling benign background noise or other known signals as the target modulation of interest.

TN / (TN + FP)
Formula
06

Macro vs. Weighted Averaging

For multi-class problems like modulation recognition, per-class metrics must be aggregated. Macro-averaging computes the metric independently for each class and takes the unweighted mean, treating all modulation schemes equally. Weighted averaging computes the mean weighted by each class's true support (number of instances), giving more influence to frequently occurring modulations. The choice depends on whether rare signal types are as important as common ones.

Macro
Equal Class Weight
Weighted
Support-Based Weight
CONFUSION MATRIX INSIGHTS

Frequently Asked Questions

A confusion matrix is the foundational diagnostic tool for evaluating automatic modulation classification (AMC) performance. It provides a granular, class-by-class breakdown of correct and incorrect predictions, revealing not just overall accuracy but the specific types of confusion occurring between modulation schemes in a cognitive radio system.

A confusion matrix is a tabular visualization that displays the performance of a classification algorithm by counting the number of correct and incorrect predictions for each actual modulation class. In automatic modulation classification (AMC), the rows of the matrix represent the true transmitted modulation scheme (e.g., QPSK, 16QAM, 64QAM), while the columns represent the classifier's predicted modulation type. Each cell C_{i,j} contains the count of instances where a signal of true class i was classified as class j. The main diagonal contains correct classifications (true positives), while off-diagonal elements represent specific misclassifications. For example, a cell at row '16QAM' and column '64QAM' quantifies how often a 16QAM signal is mistaken for 64QAM, providing critical insight into the classifier's discriminative weaknesses in the signal constellation space.

CLASSIFIER PERFORMANCE COMPARISON

Confusion Matrix vs. Other Evaluation Metrics

Comparing the diagnostic depth and applicability of the confusion matrix against aggregate metrics for modulation classification evaluation.

FeatureConfusion MatrixAccuracyROC Curve

Per-class error analysis

Aggregate performance summary

Visualizes class confusion pairs

Threshold-invariant evaluation

Handles multi-class natively

Identifies specific misclassifications

Computational simplicity

O(n_classes²)

O(1)

O(n_thresholds)

Suitable for imbalanced data

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.