0Pricing
NLP Academy · Lesson

Reading the Confusion Matrix

See exactly where the model errs.

Reading the Confusion Matrix is a free NLP Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the NLP Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

The Whole Picture

The confusion matrix is a small table showing every prediction sorted by what was true and what you guessed. It reveals exactly where errors live.

Rows and Columns

Rows are the true labels and columns are the predicted ones. Each cell counts how many examples fell into that true-versus-predicted combination.

The Four Cells

For two classes you get four counts: true positives, true negatives, and the two error types. Every metric you know is built from these.

True Positive

A true positive is a real positive you correctly flagged, like real spam sent straight to the spam folder. A clean win.

True Negative

A true negative is a real negative you correctly left alone, like a normal email that stays safely in the inbox.

False Positive

A false positive is a false alarm: you flagged something that was actually negative, like a real email wrongly marked as spam.

False Negative

A false negative is a miss: a real positive you let slip through, like spam that lands in the inbox unflagged.

The Diagonal Tells All

Correct predictions sit on the diagonal. A strong model concentrates counts there and leaves the off-diagonal cells nearly empty.

Build It in Python

scikit-learn assembles the matrix from your true and predicted labels in a single call.

from sklearn.metrics import confusion_matrix
cm = confusion_matrix(y_true, y_pred)

Make It Readable

A plotted matrix makes errors jump out, so you instantly see which class gets confused for which.

from sklearn.metrics import ConfusionMatrixDisplay
ConfusionMatrixDisplay(cm).plot()

Spotting the Weak Spot

Read off-diagonal cells to find the model blind spot. A large false-negative count, for example, warns you that real positives are being missed.

Quick Check

Name the error type from the description.

Recap

The confusion matrix splits results into four cells. The diagonal holds wins; off-diagonal cells expose exactly where your model errs. 🔍

Frequently asked questions

Is the “Reading the Confusion Matrix” lesson free?

Yes — the full text of “Reading the Confusion Matrix” is free to read here on the web, and the NLP Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the NLP Academy course, upgrade to CoddyKit PRO.

What will I learn in “Reading the Confusion Matrix”?

See exactly where the model errs. You practise NLP Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start NLP Academy?

No prior experience is required. NLP Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Reading the Confusion Matrix” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this NLP Academy lesson?

Yes. Every NLP Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Why Accuracy Can Lie
  2. Precision, Recall, and F1
  3. Reading the Confusion Matrix
  4. Cross-Validation Done Right
← Back to NLP Academy