Skip to content
atlas

Logistic regression

Also known as: logit model

A simple model that sorts cases into two groups by turning a weighted sum of the inputs into a chance between 0 and 1.

Draft - this entry has not been reviewed yet.

Formal

A method for classification that adds up the features, each times a weight, and passes the total through an S-shaped curve to get the chance of the positive group; the weights are chosen so the known answers in the training data get the highest chance.

In plain English

Like a doctor adding up points for age, smoking and blood pressure, then reading off a chart that turns the total score into a chance of illness that never goes below zero or above certain.

In practice

A Danish bank scores each loan request with the chance that the customer will fail to pay, and staff can see which answers on the form pushed the score up or down.

Why it matters

It gives a chance, not just a yes or no, and each input's effect can be read directly, which is why banks, hospitals and public bodies still rely on it when decisions must be explained.

Technical deep dive

Despite its name, logistic regression is a classifier. For binary classes it models p(y = 1 | x) = sigma(w0 + w^T x), where sigma(z) = 1 / (1 + e^-z) is the logistic (sigmoid) function. Equivalently, the log-odds log(p / (1 - p)) are a linear function of the features, so each coefficient is the change in log-odds per unit of its feature and e^w is an odds ratio. The decision boundary p = 0.5 is a hyperplane, so the model is linear in feature space; non-linear boundaries need transformed or engineered features.

The weights are fitted by maximum likelihood, which is the same as minimising the log-loss (binary cross-entropy) -[y log p + (1 - y) log(1 - p)]. Unlike least squares there is no closed-form solution, but the loss is convex, so iterative solvers such as Newton methods (iteratively reweighted least squares), L-BFGS or stochastic gradient descent reach the global optimum. If the classes are perfectly separable the unregularised weights grow without bound, which is one reason libraries apply regularisation by default: scikit-learn's LogisticRegression uses an L2 penalty with strength controlled by C (default 1.0), and also supports L1 and elastic net.

For more than two classes the multinomial (softmax) form gives each class its own weight vector and normalises the scores into a probability distribution; a one-vs-rest scheme of separate binary models is the older alternative. A single-layer neural network with a sigmoid or softmax output trained on cross-entropy is exactly logistic regression, which is why it is often taught as the bridge from classical statistics to deep learning.

The model's probabilities are usually reasonably well calibrated, a property that matters for credit scoring and clinical risk scores, but it still needs a chosen threshold to turn a probability into a decision, and the right threshold depends on the relative cost of false positives and false negatives. The method was developed in statistics, notably by Cox (1958), well before machine learning adopted it.

What to learn first

Everything this builds on, foundations first.

  1. Training data
  2. →Feature
  3. →Machine learning
  4. →Loss function
  5. →Linear regression
  6. →Logistic regression

Relationships

Implements
Classification
Don't confuse with
Linear regression

Sources & further reading

Reference works

Where this data comes from

This entry was drafted by an AI from the sources above and has not yet been checked by a person. Treat it as a starting point, and check anything important against the sources.

See the review queueSuggest a correction on GitHubThis term as JSON

Check yourself

Loading…

Atlas is in beta.