LearnMachine learning
Logistic regression
Turn a straight line into a probability, and discover what a straight line cannot separate.
Choose a colour, then click to add points. Drag points to move them, or off the chart to remove them.
How it works
A straight boundary, turned into a probability.
Logistic regression answers yes or no questions, such as spam or not spam. It draws a straight boundary and turns the distance from it into a probability between 0 and 1 using an S-shaped curve called the sigmoid.
It learns by gradient descent: every step nudges the boundary so that the correct answers become more likely. The shading shows the probability of pink, and the solid line is where it is exactly 50%. The dashed lines mark 25% and 75%. A very small penalty on the weights keeps them finite when the classes can be split perfectly.
It is fast, simple and easy to explain, which is why it is still used everywhere. Its limit is the straight boundary: when the classes curl around each other, a more flexible model is needed.