LightMySky
En anglais

Logistic Regression and the Decision Boundary

For a yes-or-no target, squeeze a linear score through a function that returns a probability, and fit by maximising likelihood. Where that probability crosses a chosen threshold is the decision boundary, and moving the threshold trades one kind of mistake for the other.

Commence ce sujetPas besoin de compte. La progression est enregistrée dans ce navigateur.

Ce que l'enfant saura faire ensuite

  • Turn a linear score into a probability and read off the predicted class
  • Draw the decision boundary of a two-feature logistic model
  • Say what moving the threshold does to each kind of error

1 · Lis

Logistic regression starts with a linear score, like z equals b0 plus b1 x1 plus b2 x2, built by weighting each feature and adding a starting value. That score can be any number, so the model squeezes it through the sigmoid curve p equals 1 over 1 plus e to minus z, which lands between 0 and 1 as a probability.

Try it together

A golf model gives a putt p equals 0.72. With a threshold of 0.5, predict yes at or above 0.5, so this putt is predicted in. With a score of z equals 1.1 and e to minus z about one third, the sigmoid gives 1 over 4 thirds, which is 0.75.

With two features the decision boundary is a straight line. Predict yes where the score tops zero and no below it, so the boundary is where the score equals zero. For z equals 2 x1 plus x2 minus 6 that line is 2 x1 plus x2 equals 6, with yes on one side and no on the other.

Moving the threshold trades one mistake for the other: raising it cuts wrong yes calls but grows wrong no calls, and lowering it does the reverse. The weights themselves are fit by maximum likelihood, which picks the weights that make the observed labels most probable, reached by stepping against the slope with a sane step size.

Score the inputs, squeeze to a probability, draw the line at the threshold, and move it to trade the two errors.

The rewritten readings were written for this dataset.

2 · Regarde

En anglais

Sans écran

Imprimer une fiche d'exercicesFormat A4, avec une page de corrigés pour les adultes. Sans écran, sans internet.

Où se situe ce sujet

Puis s'entraîner

16 questions attendent derrière cette leçon, chacune avec sa réponse expliquée. Chaque réponse nourrit le ciel : les étoiles s'allument à mesure qu'elles sont apprises, et pâlissent quand vient le moment de revenir.

Commence ce sujet