Know the Difference Between Logistic and Linear Regression Through Simple and Straight to the Point Words

Amjad El Baba
3 min readAug 4, 2021

--

It’s very important to know how to differentiate between different Machine Learning algorithms, especially those two important methods of working and building-up conclusions upon a given data.

Linear Regression

Is a Statistical method that shows a relation between dependent and independent variables, both of which are continuous.

Properties:

  • Represented by a linear equation (straight line).
  • Used to solve regression problems.
  • The response variables are continuous by nature.
  • It helps in estimating the dependent variable when there is a change in the independent variable.

Different types of Linear Regression:

Simple Linear Regression:

Represented by: Y = m*x + c

Where:

  1. x( independent variable).
  2. m(slope).
  3. C(coefficient or the y-intercept).

Multiple Linear Regression:

Represented by: Y = m1*x1 + m2*x2 + … + mn*xn + c

Where:

  1. Y(dependent variable).
  2. x1..n( independent variables).
  3. m1..n(slopes).
  4. C(coefficient or the y-intercept).

One of the most important goals is to find the line of best fit using least squares values as shown below:

Logistic Regression

Statistical method that shows a relation between dependent and independent variables, in which the dependent variable outcome is discrete, for example: true or false, a person will get hired or not…

Properties:

  • Non-linear equation (S-curve like Sigmoid).
  • Used to solve classification problems.
  • The response variables are categorical by nature.
  • It helps calculate the possibility of a particular event taking place.

Let’s see a simple example that elaborates what is Logistic Regression really about:

The math behind Logistic Regression is based on the probability of things to happen, which is (the probability of an event happening) / (the probability of an event not happening) represented by Ө.

You can check this great resource on how we can implement both Linear and Logistic Regression using python in ML and it’s basics.

  1. Intro to Data Science.
  2. Simple Linear Regression with Python.
  3. Simple Linear Regression Code Example.
  4. Simple Logistic Regression Code Example.

Thanks for your time and let’s boost our knowledge!

--

--

Amjad El Baba

Data enthusiast, developer, hard worker and a detail-oriented person who enjoys team work and leadership. Passionate about AI, Big Data and Data Science.