Linear Regression VS Logistic Regression (MACHINE LEARNING)

Linear Regression and Logistic Regression are two algorithms of machine learning and these are mostly used in the data science field.

Linear Regression:> It is one of the algorithms of machine learning which is used as a technique to solve various use cases in the data science field. It is generally used in the case of continuous output. For e.g if ‘Area’ and ‘Bhk’ of the house is given as an input and we have found the ‘Price’ of the house, so this is called a regression problem.

Mechanism:> In the diagram below X is input and Y is output value.

In the above diagram, the points(blue color) are our data points which are shown in scattered form. The line which is passing through the points is the best-fit line. If a line is drawn in such a way that the error or cost function is very less is called best fit line and the error can be calculated as: mean(sum(sqr(Euclidean distance between point and line))).

After selecting the best fit line we can predict the value of Y by putting X as an input.

Logistic Regression:> It is also one of the machine learning algorithms and it is used in the use cases. It is generally used in classification problems. For e.g if ‘CGPA’ of the student is given and we have to predict whether the student is ‘fail’ or ‘Pass’ is called a classification problem.

Mechanism:> In the diagram below X is input and Y is output.

In this diagram, the data points(green color) are given and the red curve is the best fit for given data points. This curve is known as the Sigmoid function and the threshold value is 0.5 The sigmoid function squeeze the output between 0 to 1 and therefore the range of this function is (0,1).

For a particular value of X if the value of Y is greater than 0.5 then the output is TRUE and if less than 0.5 then output is FALSE because it is used in the classification problem where the output is either TRUE or FALSE.

So this is the short explanation of Linear Regression vs Logistic Regression…