ClassificationSample

Logistic regression

Models the probability of a class with a weighted sum passed through a sigmoid.

Synthetic data, generated and trained in your browser.

Try this

  1. 01On Circles with linear features, no straight line separates the classes. Switch to quadratic.
  2. 02On Overlapping, raise λ and watch the shading fade: the model becomes less confident.
  3. 03Add an orange point deep in the blue region and see how little one point moves the boundary.

How it works

  1. 1Compute a weighted sum of the features.
  2. 2Squash it through the sigmoid to get a probability between 0 and 1.
  3. 3Adjust the weights by gradient descent to minimise cross-entropy loss.
  4. 4The boundary where the probability is 0.5 is linear in the features used.

What the controls teach

Features
Linear features give a straight boundary; quadratic features (x², y², xy) let it curve.
Regularization λ
L2 penalty on the weights. Larger values soften the probabilities and the boundary.

Use it when

  • A calibrated probability is needed
  • An interpretable baseline classifier

Avoid it when

  • Strongly non-linear boundaries without feature engineering

More in Classification