# What Is a Confusion Matrix? Read One From a Real Churn Model

Canonical: https://yourcloudblog.com/blog/what-is-a-confusion-matrix/
Published: 2026-11-17
Author: YourCloudGroup · Publisher: YourCloudGroup · Category: Model Evaluation
Tags: confusion matrix, precision, recall, churn prediction, decision threshold

> A confusion matrix counts a model's right and wrong predictions by type. Read one from a certified churn model: 27 churners found, 3 missed, 3 false alarms.

**Short answer:** A confusion matrix sorts every prediction into four cells: true positives, false negatives, false positives and true negatives. On 272 held-out customers of a public churn dataset, YourCloudGroup Model Manager's certified model found 27 of 30 churners, missed 3 and raised 3 false alarms among 242 customers who stayed: 90% precision, 90% recall. Every other evaluation figure is computed from these four counts.
**A confusion matrix is a table that counts a model's predictions by whether they were right and how they were wrong.** For a yes/no question such as "will this customer leave?", every prediction on a held-out row lands in one of four cells. Accuracy, precision, recall, balanced accuracy and the rest are all calculated from those four counts, so the matrix is the most complete one-glance view of how a classifier behaves.

**Real example:** YourCloudGroup Model Manager's certified churn model, tested on 272 customers it never trained on, **found 27 of the 30 customers who left, missed 3, and wrongly flagged 3 of the 242 who stayed.**

## The four cells

| | Predicted: will leave | Predicted: will stay |
|---|---:|---:|
| **Actually left** | True positive (TP): **27** | False negative (FN): **3** |
| **Actually stayed** | False positive (FP): **3** | True negative (TN): **239** |

- **True positive**: predicted to leave, and did. A churner you could act on.
- **False negative**: predicted to stay, but left. A churner you missed.
- **False positive**: predicted to leave, but stayed. A false alarm, perhaps a discount you did not need to give.
- **True negative**: predicted to stay, and did.

The counts come from Model Manager's [sample-data demonstration](https://yourcloudgroup.com/try/churn) on the public [Iranian Churn](https://doi.org/10.24432/C5JW3Z) dataset: 3,150 telecom customers with call failures, complaints, usage and subscription length. The product built 12 models, kept 272 customers back as blind rows, and reports these counts with the run. We recomputed them from its downloadable predictions file and got the same four numbers.

## Every metric comes from the four counts

From the matrix above:

- **Accuracy** = (TP + TN) ÷ all = 266 ÷ 272 = **97.8%**.
- **[Precision](https://yourcloudblog.com/glossary/#precision)** = TP ÷ (TP + FP) = 27 ÷ 30 = **90.0%**. When the model says "will leave", it is right 9 times in 10.
- **[Recall](https://yourcloudblog.com/glossary/#recall)** = TP ÷ (TP + FN) = 27 ÷ 30 = **90.0%**. It finds 9 in 10 of the customers who leave.
- **Specificity** (recall for "stayed") = TN ÷ (TN + FP) = 239 ÷ 242 = **98.8%**.
- **[Balanced accuracy](https://yourcloudblog.com/glossary/#balanced-accuracy)** = average of the two recalls = **94.4%**.

Why not stop at accuracy? Because only 30 of the 272 customers left. A model that predicted "stays" for everyone would score 242 ÷ 272 = **89.0% accuracy** and find no churners at all. The matrix makes that impossible to miss: its whole "Actually left" row would sit under "will stay". The 99.9% fraud example in [99.9% accurate—and why that number can be misleading](https://yourcloudblog.com/blog/99-percent-accuracy-can-be-misleading/) is the same trap, more extreme.

**Which rows the figures come from matters.** The 272 blind rows include the half Model Manager used to choose the winning model, so the product marks the figures above as diagnostic. Its certificate is computed only on the other 136 rows, which took no part in the choice: **91.9% balanced accuracy** against 50.0% for a baseline that always predicts the most common outcome, verdict **STRONG**.

## Moving the threshold moves customers between cells

Most classifiers produce a probability, and a threshold turns it into "leave" or "stay". Changing the threshold does not change the model; it moves customers between cells. We trained a gradient-boosting model on the same public data (our own 80/20 split, 630 held-out customers, 99 of whom left) and read its matrix at two thresholds:

| Threshold | TP | FN | FP | TN | Precision | Recall |
|---|---:|---:|---:|---:|---:|---:|
| 0.5 | 89 | 10 | 11 | 520 | 89.0% | 89.9% |
| 0.2 | 93 | 6 | 17 | 514 | 84.5% | 93.9% |

Lowering the threshold found 4 more churners and cost 6 more false alarms. Which is better depends on what each cell costs you: what a lost customer is worth against what an unnecessary retention offer costs. A confusion matrix is where that business decision becomes visible. (This experiment uses its own split, so its counts are not comparable with Model Manager's run.)

## Reading a confusion matrix in practice

1. **Check the rows add up to the real outcomes.** Here 27 + 3 = 30 churners and 3 + 239 = 242 stayers.
2. **Look at the cell that costs you most first**, usually the false negatives for churn or fraud.
3. **Compare with doing nothing.** Write down the matrix of the "always predict the common outcome" baseline beside it.
4. **Make sure the rows were held out.** A matrix computed on training rows says little about new customers. See [What is held-out model evaluation?](https://yourcloudblog.com/blog/what-is-held-out-model-evaluation/)

## Takeaway

A confusion matrix shows the four ways a yes/no prediction can land. On a public churn dataset, Model Manager's certified model found 27 of 30 churners with 3 false alarms among 242 customers who stayed; every summary figure, from accuracy to balanced accuracy, follows from those four counts.

**See it on sample data:** [Which customers are about to leave](https://yourcloudgroup.com/try/churn) shows how Model Manager tested a model on the public Iranian Churn (UCI) dataset: the verdict, the measured figures and the predictions to download.

## Sources

- Iranian Churn [Dataset]. UCI Machine Learning Repository. [doi:10.24432/C5JW3Z](https://doi.org/10.24432/C5JW3Z). CC BY 4.0.
- YourCloudGroup Model Manager sample-data run: [yourcloudgroup.com/try/churn](https://yourcloudgroup.com/try/churn) (verdict, certificate, confusion counts and predictions file).
- Experiment script: `confusion_matrix_churn.py` (stratified 80/20 split, seed 42, scikit-learn gradient boosting, thresholds 0.5 and 0.2).
