Skip to content

Commit 022c7e7

Browse files
spec: add confusion-matrix specification (#2277)
## New Specification: `confusion-matrix` Related to #2272 --- ### specification.md # confusion-matrix: Confusion Matrix Heatmap ## Description A specialized heatmap visualization for evaluating classification model performance, displaying the counts or proportions of predicted vs actual class labels. The confusion matrix reveals true positives, false positives, true negatives, and false negatives at a glance, making it essential for understanding model behavior, identifying class imbalances, and diagnosing specific misclassification patterns. ## Applications - Binary classification model evaluation showing sensitivity and specificity - Multi-class classifier performance analysis with per-class accuracy breakdown - Model comparison to identify which classes are most often confused - Error analysis to understand systematic misclassification patterns ## Data - `true_labels` (categorical) - ground truth class labels for each sample - `predicted_labels` (categorical) - model-predicted class labels for each sample - `class_names` (string) - display names for each class on the axes - Size: 2-20 classes (larger matrices may have readability issues) - Example: Classification results from a trained model on test data ## Notes - Label axes clearly: "True Label" (y-axis) and "Predicted Label" (x-axis) - Annotate cells with counts or percentages for precise interpretation - Support normalization options: none (raw counts), by row (recall), by column (precision), or by total - Use sequential colormap (e.g., Blues) for count data - Include colorbar showing the value scale - Consider highlighting diagonal (correct predictions) for visual clarity --- **Next:** Add `approved` label to the issue to merge this PR. --- :robot: *[spec-create workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20526498624)* Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent ef4de37 commit 022c7e7

2 files changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# confusion-matrix: Confusion Matrix Heatmap
2+
3+
## Description
4+
5+
A specialized heatmap visualization for evaluating classification model performance, displaying the counts or proportions of predicted vs actual class labels. The confusion matrix reveals true positives, false positives, true negatives, and false negatives at a glance, making it essential for understanding model behavior, identifying class imbalances, and diagnosing specific misclassification patterns.
6+
7+
## Applications
8+
9+
- Binary classification model evaluation showing sensitivity and specificity
10+
- Multi-class classifier performance analysis with per-class accuracy breakdown
11+
- Model comparison to identify which classes are most often confused
12+
- Error analysis to understand systematic misclassification patterns
13+
14+
## Data
15+
16+
- `true_labels` (categorical) - ground truth class labels for each sample
17+
- `predicted_labels` (categorical) - model-predicted class labels for each sample
18+
- `class_names` (string) - display names for each class on the axes
19+
- Size: 2-20 classes (larger matrices may have readability issues)
20+
- Example: Classification results from a trained model on test data
21+
22+
## Notes
23+
24+
- Label axes clearly: "True Label" (y-axis) and "Predicted Label" (x-axis)
25+
- Annotate cells with counts or percentages for precise interpretation
26+
- Support normalization options: none (raw counts), by row (recall), by column (precision), or by total
27+
- Use sequential colormap (e.g., Blues) for count data
28+
- Include colorbar showing the value scale
29+
- Consider highlighting diagonal (correct predictions) for visual clarity
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Specification-level metadata for confusion-matrix
2+
# Auto-synced to PostgreSQL on push to main
3+
4+
spec_id: confusion-matrix
5+
title: Confusion Matrix Heatmap
6+
7+
# Specification tracking
8+
created: 2025-12-26T17:27:45Z
9+
updated: null
10+
issue: 2272
11+
suggested: MarkusNeusinger
12+
13+
# Classification tags (applies to all library implementations)
14+
# See docs/concepts/tagging-system.md for detailed guidelines
15+
tags:
16+
plot_type:
17+
- heatmap
18+
- matrix
19+
- confusion-matrix
20+
data_type:
21+
- categorical
22+
- classification
23+
domain:
24+
- machine-learning
25+
- statistics
26+
- data-science
27+
features:
28+
- annotated
29+
- evaluation
30+
- model-performance

0 commit comments

Comments
 (0)