# Logistic regression

> Canonical: https://skillalmanac.com/glossary/logistic-regression | Last verified: 2026-11-24 | Index status: index-eligible

Logistic regression models probabilities for categorical outcomes. Binary logistic regression applies a sigmoid to a weighted feature sum; multinomial variants handle more than two classes. A decision rule converts probabilities into class predictions.

Also called: logistic regression machine learning, logistic regression classifier, logit regression, logistic model.

## In plain language

For a binary task such as spam detection, logistic regression estimates a probability between zero and one. It combines feature values and applies a sigmoid; a chosen threshold turns that probability into a yes-or-no prediction. More than two classes require an appropriate multiclass formulation. The boundary is linear in the supplied features; transformations can make it nonlinear in the original inputs. A simple model can still overfit.

## Technical definition

Binary logistic regression models the log-odds of one class as an affine function of features. Applying a sigmoid yields its probability estimate. Multinomial logistic regression instead models several class probabilities, commonly with softmax. Log-loss fitting can include regularization; scikit-learn applies regularization by default. Probability estimates, decision thresholds and class predictions are distinct outputs or choices.

## How it shows up when you use agents

Logistic regression is a classic modelling method, and can appear when you ask an agent to build a quick classifier on a table, for example with scikit-learn, and when someone proposes it as a baseline before a heavier model. A binary fit can return a positive-class probability per row and a coefficient per supplied feature; multiclass models have additional class-specific parameters.

What breaks when it is misunderstood. People treat the 0.5 cutoff as fixed, although you can move it to suit the cost of each kind of mistake. They also forget that scikit-learn applies regularization by default, which changes the coefficients compared with a textbook fit. And they read a high score as proof, when a leaky split can inflate it.

Next actions. Profile the data, fit on training rows, and evaluate on held-out rows after checking the split with [split-leakage-check](/skills/skill-almanac/split-leakage-check). It is one kind of [classification](/glossary/classification) and a form of [supervised learning](/glossary/supervised-learning).

## Worked example (illustrative)

Choose a binary model whose logit for one row is ln(3). The sigmoid gives 3 / (1 + 3) = 0.75. With a positive-class threshold of 0.7, that row receives the positive label. A threshold of 0.8 would give the negative label without changing the probability estimate. These calculated toy values demonstrate a decision rule, not calibration or real classifier accuracy.

## Common confusions

- **Logistic regression versus linear regression.** Linear regression predicts a number. Logistic regression predicts the probability of a category. scikit-learn notes that despite the name it is a model for classification.
- **Probability versus decision.** For binary prediction, a threshold turns a probability into a class. Multiclass prediction needs an appropriate rule, such as selecting the largest class probability.
- **Binary versus multinomial.** IBM lists binary, multinomial and ordinal types, depending on the number and order of outcomes.
- **Myth.** Logistic regression cannot overfit because it is simple. IBM notes the risk rises with many predictors and a small sample. Regularization is one way to limit it. See [Regularization](/glossary/regularization).

## Worked examples in this catalogue

### [split-leakage-check](https://skillalmanac.com/skills/skill-almanac/split-leakage-check)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A check of train, validation and test files for duplicates, shared groups, time and label leakage, printed as JSON.

Why it exercises the concept: A logistic regression baseline is only meaningful if the test file is clean. The catalogue has no training skills; this is the nearest check that applies to any classifier.

### [data-analysis-eda](https://skillalmanac.com/skills/skill-almanac/data-analysis-eda)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A fixed exploratory-analysis procedure and CSV profiler that keeps findings descriptive, evidenced and caveated.

Why it exercises the concept: Profiling the columns and the label balance comes before fitting a classifier. This skill does the profiling; it does not fit a model.

### [sample-size-calculator](https://skillalmanac.com/skills/skill-almanac/sample-size-calculator)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Computes the minimum number of subjects per group for a planned comparison of two proportions, two means, or one mean, using the normal approximation.

Why it exercises the concept: A contrast case from classical statistics: it plans a comparison of proportions, while logistic regression models a probability from features. Both deal with yes-or-no outcomes, but they answer different questions.

### [Claude Code](https://skillalmanac.com/tools/claude-code)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Claude Code's overview page describes it as an agentic coding tool that reads your codebase, edits files, runs commands, and integrates with your development tools.

Why it exercises the concept: A coding agent can fit scikit-learn's LogisticRegression on a small table and print the predicted probabilities, so you can see the cutoff decision for yourself.

## Related terms

- [Classification](https://skillalmanac.com/glossary/classification.md)
- [Supervised learning](https://skillalmanac.com/glossary/supervised-learning.md)
- [Machine learning (ML)](https://skillalmanac.com/glossary/machine-learning.md)
- [Loss function](https://skillalmanac.com/glossary/loss-function.md)
- [Regularization](https://skillalmanac.com/glossary/regularization.md)
- [Overfitting](https://skillalmanac.com/glossary/overfitting.md)
- [Linear regression](https://skillalmanac.com/glossary/linear-regression.md)

## Sources

- [1.1. Linear Models (Logistic regression)](https://scikit-learn.org/stable/modules/linear_model.html), scikit-learn (accessed 2026-11-24)
- [What is logistic regression?](https://www.ibm.com/think/topics/logistic-regression), IBM (accessed 2026-11-24)
- [Logistic Regression](https://developers.google.com/machine-learning/crash-course/logistic-regression), Google for Developers (Machine Learning Crash Course) (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-24. [Glossary index](https://skillalmanac.com/glossary.md).
