# Logistic Regression

*noun*

say it: **“loh-JIS-tik rih-GRESH-un”** **/loʊˈdʒɪstɪk rɪˈɡrɛʃən/**

A statistical model that gives the probability that an example belongs to a category, used to sort examples into classes.

## What is **logistic regression**?

**Logistic regression** is a classification model, despite its name. It adds up the features times their coefficients,
as linear regression does, then squeezes the total into a probability between 0 and 1 with the logistic function, and
picks the positive class at 0.5 or more. scikit-learn's is `LogisticRegression`.

```python
from sklearn.linear_model import LogisticRegression
links = [[0], [1], [2], [6], [8], [9]]   # links in each email
spam = [0, 0, 0, 1, 1, 1]
model = LogisticRegression().fit(links, spam)
print(model.predict([[1], [7]]))   # [0 1]: not spam, spam
```

## In a sentence

- “**Logistic regression** gave the email a 0.92 chance of being spam.”
- “Despite the name, **logistic regression** sorts examples into categories.”

Level: Journeyman · [More AI Basics terms at this level](https://www.ask-codey.com/glossary?category=ai&level=3)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/logistic-regression
