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
- 01On Circles with linear features, no straight line separates the classes. Switch to quadratic.
- 02On Overlapping, raise λ and watch the shading fade: the model becomes less confident.
- 03Add an orange point deep in the blue region and see how little one point moves the boundary.
How it works
- 1Compute a weighted sum of the features.
- 2Squash it through the sigmoid to get a probability between 0 and 1.
- 3Adjust the weights by gradient descent to minimise cross-entropy loss.
- 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
k-nearest neighbours
Classifies a point by the majority class among its k nearest neighbours.
Decision tree
Learns a sequence of yes/no questions on the features that ends in a class.
Naive Bayes (Gaussian)
Applies Bayes’ theorem, assuming each feature is normally distributed and independent within a class.