All Posts

Linear Regression vs Logistic Regression

Linear Regression vs Logistic Regression

Let’s look at some of the differences between linear regression and logistic regression in this tutorial.

Linear Regression

Linear regression is a statistical method used to model the relationship between a dependent variable and one or more independent variables. It predicts continuous output values based on the input features.

Logistic Regression

Logistic regression is a binary classification algorithm used to predict the probability of a categorical dependent variable, typically a binary outcome (0 or 1). It maps the output to a probability using a logistic function (sigmoid function).

Differences Between Linear Regression and Logistic Regression

Aspect Linear Regression Logistic Regression
Output Continuous numerical value Probability of a categorical outcome (usually 0 or 1)
Model Type Regression (predicts values) Classification (predicts class labels)
Equation y = β₀ + β₁x₁ + β₂x₂ + … + βₙxₙ p = 1 / (1 + e^(-z))

where z = β₀ + β₁x₁ + β₂x₂ + … + βₙxₙ

Prediction Range Unbounded (output can range from -∞ to +∞) Bounded (output is between 0 and 1)
Used For Predicting continuous values, such as prices, temperature, etc. Classifying binary outcomes, such as Yes/No or 0/1
Error Metric Mean Squared Error (MSE) or Root Mean Squared Error (RMSE) Log-Loss or Cross-Entropy Loss
Linearity Assumes a linear relationship between independent and dependent variables Uses a non-linear logistic function (sigmoid) to model the probability