Skip to content

Stage 1 · Beginner · M2

Drawing the Line

Spam filters, credit scores and cancer screens are all one question: which side of the line?

14 lessons · 131 minSteady

About this chapter

A straight line cannot answer yes or no, and watching it fail is the fastest way to understand the fix. Bolt a soft curve on the end and you have the model that still ends most neural network classifiers, including the ones with billions of weights. The second half is the part most teachers rush: four boxes instead of one accuracy number, the two ratios everybody quotes, and a threshold chosen from what a mistake actually costs. You leave able to say what your model gets wrong, and to defend the line you drew.

What you will be able to do

  1. 1

    From a Line to a Label

    Say why a straight line fitted to yes and no labels gives answers nobody can use.

    8 min
  2. 2

    The Soft Switch

    Read the sigmoid's output as a chance, and turn a chance back into the score behind it.

    8 min
  3. 3

    Logistic Regression

    Read a fitted logistic model: its weight, its bias, and where it changes its mind.

    10 min
  4. 4

    The Loss That Punishes Confidence

    Charge a classifier for one answer, and say why squared error is too gentle here.

    9 min
  5. 5

    Where the Numbers Came From

    Walk a classifier downhill from nothing to a fitted weight and bias.

    10 min
  6. 6

    Boundaries You Can See

    Predict which data shapes a straight boundary can handle, and bend it when it cannot.

    12 min
  7. 7

    The Model That Never Trains

    Classify by asking the nearest examples, and say what that costs you.

    9 min
  8. 8

    The Four Boxes

    Split a classifier's mistakes into the two kinds and name each box in your own task.

    9 min
  9. 9

    Caught and Cried Wolf

    Compute precision and recall, and say which one your own task depends on.

    10 min
  10. 10

    Choosing a Cut From Money

    Pick a threshold that costs least, instead of the one that ships by default.

    10 min
  11. 11

    Every Threshold at Once

    Read an ROC curve and say in one sentence what the area under it means.

    10 min
  12. 12

    When the Answer Is Almost Always No

    Judge a classifier when one class is one in a thousand, and say what breaks.

    9 min
  13. 13

    More Than Two Answers

    Give every class its own line, turn the scores into chances, and read the nine boxes that replace the four.

    9 min
  14. 14

    The Last Layer of Everything

    Point at the unit you built at the end of any neural network classifier, however large.

    8 min

Before you start

Keep going

All chapters