Linear Regression and Logistic Regression — What is different?

Übermensch
4 min readMay 21, 2023
Image from Spotio

What is a regression model in Machine Learning?

A Regression is a technique to find and analyze the relationship between independent variables and target values, when the data type of target ( dependent variable) is numerical types, meaning that a regression model is used as a method in machine learning, in which an algorithm is used to predict continuous outcomes. In continuous or numerical types, for example, there are integer, float, double, decimal or long data type, such as 10, 2.5, 0.05 and 4902342.

Supervised Learning vs. Unsupervised Learning

Before we get into difference between linear regression and logistic regression, let’s clarify what is difference between supervised and unsupervised learning. In machine learning, there are representatively 3 types of learning methods such as Deep Learning, Supervised Learning and Unsupervised Learning.

Supervised Learning

Supervised Learning

Supervised Learning is an algorithm with labelled input data, meaning that we already know what kinds of input data including features and target will be trained and tested for specific machine learning algorithms. As a supervised learning, the algorithm can make predictions or classifications with newly input and unseen data throughout a mapping or a relationship.

Let’s say we have a dataset as below and we are going to analyze what the target will be, if we put a new data as ‘Dog’. Since the computer already knows features, which are either Dog or Cat, and targets, which are either Woof or Meow, the computer with the supervised learning algorithm can predict the outcome of the new input data ‘Dog’ will be ‘Woof’.

Unsupervised Learning

Unsupervised Learning

On the other hand, Unsupervised Learning is an algorithm with unlabeled input dat, meaning that we do NOT know pre-defined features and target variable. When it comes to analyzing unknown data without labels, we mainly aims at finding hidden patterns, structures or relationships with shared similarities. For example, the data can explore and identify inherent clusters based on dissimilarity and similarity of the sample data.

Commonly, this technique is used for the following methods such as K-means Clustering and DBSCAN(Density-Based Spatial Clustering of Applications). With these techniques, it is handy to visualize complicated data relationship, by discovering hidden patterns, grouping similar data and gaining insights for data analysis.

Linear Regression vs Logistic Regression

Linear regression and Logistic regression are both regression models, predicting the target value, but for different types of tasks(target data type).

Example of Linear Regression
Image from : https://www.javatpoint.com/logistic-regression-in-machine-learning

Linear Regression is used for predicting continuous values, establishing a linear relationship between input features(independent variables) and the numerical type’s target value(dependent variable), while Logistic Regression is used for predicting binary classification tasks such as Boolean type, analyzing the probability, assuming that input features belong to a specific class or category such as TRUE or FALSE, Yes or No and 1 or 0.

Difference between linear regression and logistic regression

Summary

Linear Regression

  • Predict a quantitative response variable
  • Parametric method with certain assumptions about the data

Logistic Regression

  • Predict a probability
  • Classify data into two or more classes

Linear regression is used for predicting numerical values with continuous values as outputs and logistic regression is used for predicting categorical values with probabilities as outputs. Due to these different characteristics of 2 models, they use different functions to measure how accurate the model is such as hypothesis functions, training methods and loss functions.

--

--