How to use the Logistic Regression Calculator
- 1. Choose fit or predictFit a model to your data, or predict from coefficients you already have.
- 2. Enter data or coefficientsPaste rows with features first and the 0/1 outcome last, or type the intercept, coefficients and feature values.
- 3. Read the modelGet coefficients, odds ratios, accuracy and log loss, or the probability and predicted class.
How it works
Logistic regression models the log-odds of the outcome as a straight line: log(p ÷ (1 − p)) = b₀ + b₁x₁ + … . The probability is p = 1 ÷ (1 + e^(−z)). Each coefficient's exponent, e^b, is an odds ratio: how the odds multiply for a one-unit increase in that feature. Fitting finds the coefficients that make the observed outcomes most likely, using Newton's method (iteratively reweighted least squares). It's plain maximum likelihood with no regularisation, and it warns you when the classes can be separated perfectly, because then the coefficients don't converge.
Worked example
The default data have 16 students with study hours, attendance % and whether they passed (8 passed). The fitted model is log-odds = −15.9959 + 0.3083·hours + 0.1942·attendance, found in 8 Newton steps. The odds ratios are 1.3610 per extra hour and 1.2143 per extra attendance point. Log loss is 0.3815, McFadden pseudo-R² 0.4495 and accuracy 81.25% on these rows. In predict mode, coefficients −4 and 0.8 with x = 6 give z = 0.8 and a probability of 69.00%, so the predicted class is 1.
Checked against scikit-learn
On the default data and on 25 random datasets with one to three features, the fitted coefficients match scikit-learn's LogisticRegression with no penalty. Note that scikit-learn's default adds L2 regularisation, so its default coefficients will be smaller than these.
Frequently asked questions
Can I use categorical features?
Yes, after turning them into 0/1 columns (one-hot encoding), leaving one category out as the baseline.
Why is accuracy on my data optimistic?
The model was fitted to these same rows. Check it on data the model hasn't seen.
Is the logistic regression calculator free?
Yes. You can open the logistic regression calculator and enter all your numbers without signing up. When you fit or predict for the first time, we ask once for your name and WhatsApp number; after that it, and every other Uncodemy tool, opens straight away.