Logistic regression
Logistic regression is a statistical and machine learning model that estimates the probability of a yes-or-no outcome, such as whether an email is spam, from one or more inputs.
Logistic regression starts like linear regression, with a weighted sum of the inputs plus a bias. Instead of using that number directly, it passes it through the sigmoid, or logistic, function, an S-shaped curve that squeezes any value into the range 0 to 1. The result is read as a probability. A threshold, often 0.5, then turns the probability into a decision: spam or not spam, default or no default.
Strictly, the weighted sum models the log-odds of the outcome. That gives each input a clean interpretation: a one-unit increase multiplies the odds of the outcome by a fixed factor. The model is trained by maximum likelihood, which in machine learning terms means minimising log loss, also called cross-entropy. There is no direct formula for the best weights, so they are found by iterative numerical methods. Multinomial logistic regression extends the idea to more than two categories.
The statistician Joseph Berkson developed and popularised the model, coining the word logit in 1944, and since about 1970 it has been the most widely used model for yes-or-no outcomes. It became a workhorse in medicine: the Trauma and Injury Severity Score, which estimates the chance of death for injured patients, was built with it, and it is used to predict the risk of diabetes and heart disease.
Businesses use it to predict whether a customer will cancel a subscription or whether a homeowner will default on a mortgage. Google's Machine Learning Crash Course introduces it with questions like whether it will rain today or whether an email is spam.
Despite the name, logistic regression is mainly used for classification. It is fast, its weights can be read and explained, and it is a sensible baseline: if a far more complex model cannot clearly beat it on the same data, the extra complexity is hard to justify.
Because it is a regression on the log-odds of the outcome: it fits a linear relationship and produces a continuous probability. It only becomes a classifier when a threshold is applied to that probability. It converts the model's raw weighted sum, which can be any number, into a value between 0 and 1. Large positive sums map close to 1, large negative sums close to 0, and zero maps to 0.5. Linear regression predicts a number on an open scale, such as a price. Logistic regression predicts the probability of a category, such as yes or no, and is trained with log loss rather than squared error. Not in the usual sense, but the two are closely related. A single artificial neuron with a sigmoid activation, trained with log loss, computes exactly the same function as logistic regression.Common questions
Why is it called regression if it is used for classification?
What does the sigmoid function do in logistic regression?
What is the difference between logistic and linear regression?
Is logistic regression a neural network?
Search for "logistic regression", "log-odds" or "log loss" alongside the field you care about, such as medicine or credit risk. Reliable sources include university statistics and biostatistics courses, library documentation from scikit-learn or statsmodels, and Google's Machine Learning Crash Course. When a study reports odds ratios from logistic regression, check whether it controls for the obvious confounders before reading the result as cause and effect.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.