Middle — Senior
Mis vahe on lineaarse ja logistilise regressiooni vahel?
sobes.tech AI
Vastus AI-lt
Linear and logistic regressions are machine learning methods for solving different tasks:
-
Linear regression is used to predict continuous numerical values. The model builds a linear dependency between input features and the target variable.
-
Logistic regression is applied to classification tasks, usually binary. It estimates the probability that an object belongs to one of the classes, using the logistic (sigmoid) function to transform the linear combination of features into a probability from 0 to 1.
Example:
- Linear regression: predicting the price of a house based on area and number of rooms.
- Logistic regression: determining whether an email is spam (yes/no).
The main difference lies in the target variable and the activation function:
| Feature | Linear regression | Logistic regression |
|---|---|---|
| Task type | Regression (number) | Classification (class labels) |
| Target variable | Continuous | Discrete (usually 0 or 1) |
| Activation function | Linear | Logistic (sigmoid) |
| Model output | Any number | Probability (0..1) |