Yes, logistic regression is a classification algorithm. Despite having “regression” in its name, its purpose is to predict which category something belongs to, not to predict a continuous number. It does this by estimating the probability that an input falls into a particular class, then assigning a label based on that probability.
The name causes genuine confusion because logistic regression is built on top of a regression technique. It starts by calculating a weighted sum of input features, just like linear regression. But instead of outputting that number directly, it transforms it into a probability between 0 and 1. That transformation is what makes it a classifier.
Why It’s Called “Regression” but Isn’t One
The confusion comes from how the model works under the hood. Logistic regression begins the same way linear regression does: it multiplies each input feature by a weight and adds them together. If you stopped there, you’d have a regression model that could spit out any number on a continuous scale.
But logistic regression adds a critical extra step. It feeds that linear sum through a function called the sigmoid, which squashes any value into the range of 0 to 1. A large positive number gets pushed close to 1. A large negative number gets pushed close to 0. Values near zero land around 0.5. The result is always interpretable as a probability.
Once you have a probability, you apply a cutoff. The standard default is 0.5: if the predicted probability is above 0.5, the model assigns the input to one class (say, “yes”), and if it’s below 0.5, it assigns the other (“no”). That hard assignment into categories is what makes logistic regression a classification algorithm, not a regression one.
How It Differs From Linear Regression
The core difference is the type of outcome each model predicts. Linear regression predicts continuous values, things like hospital stay length, blood pressure, or temperature. Logistic regression predicts categorical outcomes: does a patient have a disease or not, will a customer buy or not, is an email spam or not.
Linear regression measures its relationships using coefficients that tell you how much the outcome changes per unit increase in the input. If height increases by one centimeter, predicted lung capacity might increase by 25 milliliters. Logistic regression instead works in odds. Its output tells you how much the odds of belonging to a class change per unit increase in the input. An odds ratio of 1 means no association, above 1 means increased odds, and below 1 means decreased odds.
They also differ in how they measure error during training. Linear regression uses squared error, penalizing predictions based on how far off the number is. Logistic regression uses something called log loss, which penalizes confident wrong predictions much more harshly than uncertain ones. If the model predicts a 0.99 probability for something that turns out to be false, the penalty is severe. This keeps the model honest about its confidence levels.
The Sigmoid Function in Plain Terms
The sigmoid function is the mathematical engine that converts a raw score into a probability. Picture an S-shaped curve. On the far left, the output is nearly 0. On the far right, it’s nearly 1. In the middle, it transitions smoothly. No matter what number you feed in, the output always lands between 0 and 1.
This is what makes logistic regression useful for classification. A raw score of 10 doesn’t become a prediction of “10.” It becomes a probability of roughly 0.9999, meaning the model is extremely confident the input belongs to class 1. A raw score of negative 10 becomes a probability near 0.0001, meaning class 0 is almost certain. The sigmoid ensures the model’s output is always interpretable as a likelihood.
Beyond Two Categories
Standard logistic regression handles binary outcomes: yes or no, spam or not spam, malignant or benign. But variants exist for situations with more than two categories.
- Multinomial logistic regression handles outcomes with multiple unordered categories. If you’re classifying an image as a cat, dog, or bird, none of those categories has a natural ranking, so the multinomial version is appropriate.
- Ordinal logistic regression handles outcomes where categories have a natural order. Think pain levels (mild, moderate, severe) or customer satisfaction ratings (low, medium, high). This variant takes advantage of that ranking to produce better predictions.
If you’re working with ordinal data but the model’s statistical assumptions aren’t met, multinomial logistic regression works as a fallback since it makes fewer assumptions about the structure of your categories.
Adjusting the Decision Threshold
The default 0.5 cutoff isn’t always the right choice. In many real-world problems, the cost of one type of mistake is much higher than the other. A cancer screening tool, for example, should err on the side of flagging potential cases, even if it means more false positives. Missing an actual cancer (a false negative) is far more costly.
You can move the threshold to match these priorities. Lowering it to 0.3 means the model will classify more inputs as positive, catching more true positives but also generating more false alarms. Raising it to 0.7 makes the model more conservative, only predicting positive when it’s fairly confident. Tools like scikit-learn allow you to tune this threshold automatically by optimizing for whatever metric matters most to your problem.
Common Real-World Uses
Logistic regression is one of the most widely used classification algorithms in practice, largely because it’s fast, interpretable, and works well when the relationship between inputs and outcomes is reasonably straightforward.
In medicine, it’s used to predict whether a patient has a condition based on risk factors. A model might take years of smoking history and BMI as inputs and predict the probability of a lung cancer diagnosis. Heart disease risk, hospital readmission, and patient mortality are all commonly modeled with logistic regression. In finance, it powers credit scoring models that predict whether a borrower will default, and fraud detection systems that flag suspicious transactions. Email spam filters and customer churn predictions are other everyday applications.
The appeal in all these cases is the same: you need a yes-or-no answer, and you want to understand why the model made its decision. Unlike complex models that function as black boxes, logistic regression lets you inspect the weight of each input feature directly.
How to Measure Performance
Because logistic regression is a classifier, you evaluate it with classification metrics rather than the error-based metrics used for regression.
- Accuracy is the simplest measure: what percentage of predictions were correct. It breaks down when classes are imbalanced, though. A model that always predicts “no fraud” on a dataset where 99% of transactions are legitimate gets 99% accuracy while being completely useless.
- F1 score balances precision (how many of the positive predictions were actually correct) and recall (how many actual positives the model caught). It’s more informative than accuracy when one class is much rarer than the other.
- ROC-AUC measures how well the model separates the two classes across all possible thresholds. A score of 1.0 means perfect separation. A score of 0.5 means the model is no better than flipping a coin. This metric is especially useful because it evaluates the model’s probability estimates rather than just its final class assignments.
For problems with more than two classes, weighted and averaged versions of these metrics exist to account for differences in class sizes and importance.

