Classification & Loss Functions

Notebook excerpts

A plain-text scan of every section in this note — the interactive, fully-styled version is in the reader above. Use whichever helps.

  1. 01

    01 What a classifier predicts

    Definition. A classifier maps an input to a real-valued score (a “logit”), and a threshold on that score decides the class. The score is “how strongly,” not yet “how likely.”

  2. 02

    02 Scores → probabilities: sigmoid & softmax

    Definition. The sigmoid squashes one score into a probability in (0,1) ; softmax turns a vector of scores into a probability distribution that sums to 1.

  3. 03

    03 The loss: cross-entropy

    Definition. Cross-entropy (log-loss) measures the distance between the predicted probability and the true label — small when you are confidently right, large and fast-growing when you are confidently wrong.

  4. 04

    04 Grading it: the confusion matrix

    Definition. The confusion matrix splits predictions into TP, FP, FN, TN; precision, recall, and F1 are ratios of those four counts that expose what a single accuracy number hides.

  5. 05

    05 Threshold-free quality: ROC & AUC

    Definition. The ROC curve plots true-positive rate against false-positive rate across every threshold; AUC is the area under it — one number for how well the scores rank positives above negatives.

  6. 06

    06 One-screen reference

    The whole path, side by side — squash, train, then judge.