Machine Learning

Logistic Regression — Classification Basics

Learn logistic regression by training one: pick a dataset or click to add points, choose polynomial features, learning rate and L2 regularisation, and watch gradient descent fit the probability map. Move the decision threshold to see precision, recall, the confusion matrix and the ROC curve change.
Trained live in your browserInteractive

Probability map

untrained
Click adds class

Data

200
0.3

Model

1
0.01

Larger λ keeps the weights small and the boundary smoother.

500

How to use this tool

  1. 1Choose a dataset (or click on the plot to add points of the selected class).
  2. 2Set the features, learning rate, regularisation and number of epochs, then press Train.
  3. 3Watch the loss fall and the decision boundary move; misclassified points are ringed.
  4. 4Move the threshold and compare training and test metrics, the confusion matrix and ROC curve.

Frequently asked questions

Batch gradient descent on the average log loss plus an L2 penalty (λ/2n)·‖w‖². With enough epochs the weights match scikit-learn’s LogisticRegression with C = 1/λ.

A plain logistic regression draws a straight boundary. Adding x1², x1·x2, x2² and higher terms lets it draw curves, for example around a circle — at the risk of overfitting, which regularisation controls.

Predictions only. Lowering it catches more positives (higher recall) at the cost of more false alarms (lower precision); the ROC curve shows this trade-off for every threshold.

No. Everything is calculated in your browser; nothing you enter is sent to MuhammadLab.