About Logistic Regression Visualizer
This logistic regression visualizer trains a model by batch gradient descent on two blobs of points and colours the plane by its predicted class. It is free, needs no sign-up and runs in your browser, so nothing you enter is uploaded.
Logistic regression models the log-odds of a class as a linear function of the features, so with degree 1 the boundary is a straight line. It is trained by gradient descent on the log loss, which is why the gradient descent visualizer is a good companion to this tool.
Inputs are scaled to about -1 to 1 internally so one learning rate works for any data. The model has no regularisation and runs a fixed number of steps. Tap the plot to add points and the line moves.
How to use Logistic Regression Visualizer
- Choose an algorithm: k-nearest neighbours, logistic regression or Gaussian naive Bayes.
- Load a dataset (blobs, moons, circles or XOR), or clear the points and tap the plot to add your own. Choose which class a tap adds.
- Set the algorithm's option: k for nearest neighbours, or the polynomial degree for logistic regression.
- Look at the coloured regions. Each cell takes the colour of the class the model predicts there.
- Switch the view to Cross-validation, choose the number of folds, and read the accuracy per fold and the mean.
- Compare algorithms and settings on the same data using the mean cross-validation accuracy, not the training accuracy.
Features
- Three classic classifiers written from scratch: kNN, softmax logistic regression and Gaussian naive Bayes.
- Decision-region canvas that scales to your screen and accepts taps to add points.
- Polynomial features of degree 1 to 3 for logistic regression, so it can learn curved boundaries.
- Five datasets, up to three classes and up to 800 points.
- k-fold cross-validation from 2 to 10 folds with a per-fold accuracy table, mean and standard deviation.
- Repeatable results: folds are shuffled with a fixed seed.
Logistic regression
The probability of the class is the sigmoid of a linear score.
P(y = 1 | x) = 1 / (1 + exp(-(w . x + b)))Worked examples
Two blobs, degree 1 gives training 100%, 5-fold CV 100%
The two blobs are far enough apart that a straight line separates them, so there is nothing for a curve to add.
Privacy: how it works
- The points and the models stay in your browser tab. Nothing is sent to Ulkaa or anyone else.
Tips
- Try k = 1, then k = 15, on the moons data and compare the boundary: small k is jagged, large k is smooth and may cut corners.
- Add a single stray point of the wrong class inside a cluster and watch kNN with small k carve a tiny island around it.
- On XOR, naive Bayes and plain logistic regression stay near chance, while kNN and polynomial logistic regression do well.
- Use at least 10 points per class for cross-validation, or fold accuracies jump in large steps.
Frequently asked questions
Is it really free?
Yes. There is no price, no trial and no credit card. Ulkaa Tool does the work with your own device, so there is no server bill to pass on to you.
Do I need an account?
No. There is no sign-up and no login. Open the page and use it. An Ulkaa account is not needed for anything on this tool.
Does it run in my browser?
Yes. Your points are processed by code running in your browser tab, on your own device.
Is my data uploaded?
No. Your points are never sent to Ulkaa or to anyone else. You can check this yourself by watching the Network tab in your browser developer tools while you use the tool.
Is logistic regression a linear classifier?
Yes. Its decision boundary is a line or a plane in the feature space. Adding polynomial features lets it fit curves in the original space.
How is logistic regression trained?
By minimising the log loss with gradient descent or a related method. This tool uses batch gradient descent.
More Classifier Playground pages
- Classifier PlaygroundDraw points, pick an algorithm and watch the decision boundary, then check it with cross-validation.
- KNN Classifier VisualizerWatch the nearest-neighbour decision regions change as you vary k.
- KNN Overfitting With Small KSet k to 1 on noisy moons and see the jagged boundary and the 100% training score.
- Logistic Regression Decision BoundarySee how polynomial features let logistic regression separate a ring from its core.
- Naive Bayes Classifier VisualizerSee the smooth regions of a Gaussian naive Bayes model on three clusters.
- Gaussian Naive Bayes on XORRun naive Bayes on a pattern it cannot learn, and compare it with kNN.
- K-Fold Cross-Validation CalculatorSplit the data into folds, test each in turn, and read the accuracy per fold.
- Cross-Validation for Logistic RegressionCheck a polynomial logistic regression on unseen folds of the two moons data.