01Chapter 1: Predicted labels versus actual labelsA confusion matrix is built from two lists of labels for the same examples. One list says what each example really is. The other says what the model claimed it was. This chapter defines those two lists, shows how they are produced, and covers the mistakes that make every later number wrong.6 min read
02Chapter 2: The four outcomes: TP, FP, FN, TNThis chapter assumes you know what supervised binary classification is, can read short Python snippets, and are comfortable with counts and ratios. It covers the four cells of a binary confusion matrix and how to assign each prediction to one of them. Matrix layout, axis conventions and the metrics 6 min read
03Chapter 3: Laying out the matrix and checking its axesA confusion matrix is a table of counts. Before you read any number in it, you need to know which axis holds the actual labels and which holds the predicted labels. This chapter assumes you know the four outcomes (TP, FP, FN, TN) from the previous chapter, and that you can read short Python snippets6 min read
04Chapter 4: Accuracy: the share of correct predictionsAccuracy is the first number most people compute from a confusion matrix. It is simple and often useful, but it hides a lot. This chapter shows exactly how it is built from the cells, what it tells you, and where it stops telling you anything.5 min read
05Chapter 5: Precision: how trustworthy a positive prediction isThis chapter assumes you can read a binary confusion matrix (you know the four cells TP, FP, FN and TN) and can follow short Python snippets that use scikit-learn. Everything here builds on those four counts.6 min read
06Chapter 6: Recall: how many real positives were foundThis chapter assumes you can read a binary confusion matrix and name its four cells (TP, FP, FN, TN). It also assumes you are comfortable with ratios and short Python snippets. Here you will learn what recall measures and how to compute it by hand and with scikit-learn. You will also learn how it be5 min read
07Chapter 7: Why accuracy misleads on imbalanced dataThis chapter assumes you can read the four cells of a binary confusion matrix (TP, FP, FN, TN). It also assumes you know the basic formulas for accuracy, precision and recall, and can read short Python snippets. The goal is to show when accuracy stops telling you anything useful, and which numbers t5 min read
08Chapter 8: F1: combining precision and recallThis chapter assumes you can already compute precision and recall from the four cells of a binary confusion matrix. You should also be comfortable reading short Python snippets that use scikit-learn. Here you will learn what F1 measures, why it uses a harmonic mean, what it ignores, and where it mis5 min read
09Chapter 9: Specificity and false positive rateThis chapter assumes you can already read a binary confusion matrix and name its four cells (TP, FP, FN, TN). It also assumes you know that scikit-learn puts actual labels in rows and predicted labels in columns. You should be comfortable with recall and precision as ratios of those cells.5 min read
10Chapter 10: How the decision threshold reshapes the matrixThis chapter assumes you can read a binary confusion matrix (rows are actual labels, columns are predicted labels, in scikit-learn's orientation). It also assumes you know precision, recall and specificity, and that you can read short Python snippets. Here the question is where the cell counts come 6 min read
11Chapter 11: Axis conventions in scikit-learn and other toolsThis chapter assumes you can already name the four outcomes (TP, FP, FN, TN) and compute precision and recall from them. You should also be able to read short Python snippets. The topic here is orientation: the same four counts can be arranged in more than one way, and a metric computed from the wro5 min read
12Chapter 12: Normalizing by row, column or totalThis chapter assumes you can read a raw confusion matrix and know the four outcomes (TP, FP, FN, TN). It also assumes you know the scikit-learn layout, where rows are actual labels and columns are predicted labels. Normalizing divides each count by a total, so cells become proportions. Which total y5 min read
13Chapter 13: Reading a multiclass matrixThis chapter assumes you can read a binary confusion matrix and compute precision and recall from its four cells. It also assumes you can follow short Python snippets that use NumPy and scikit-learn. Here the same ideas extend to three or more classes.6 min read
14Chapter 14: Macro, micro and weighted averagesThis chapter assumes you can read a multiclass confusion matrix and compute precision, recall and F1 for one class. It also assumes you know that scikit-learn puts actual labels on rows and predicted labels on columns. The question here is how to turn one number per class into one number for the who6 min read