ML | Linear Regression vs Logistic Regression
Last Updated :
22 Apr, 2023
Improve
Linear Regression is a machine learning algorithm based on supervised regression algorithm. Regression models a target prediction value based on independent variables. It is mostly used for finding out the relationship between variables and forecasting. Different regression models differ based on – the kind of relationship between the dependent and independent variables, they are considering and the number of independent variables being used. Logistic regression is basically a supervised classification algorithm. In a classification problem, the target variable(or output), y, can take only discrete values for a given set of features(or inputs), X.
Sl.No. | Linear Regression | Logistic Regression |
---|---|---|
1. | Linear Regression is a supervised regression model. | Logistic Regression is a supervised classification model. |
2. | Equation of linear regression: y = a0 + a1x1 + a2x2 + … + aixi Here, y = response variable xi = ith predictor variable ai = average effect on y as xi increases by 1 |
Equation of logistic regression y(x) = e(a0 + a1x1 + a2x2 + … + aixi) / (1 + e(a0 + a1x1 + a2x2 + … + aixi)) Here, y = response variable xi = ith predictor variable ai = average effect on y as xi increases by 1 |
3. | In Linear Regression, we predict the value by an integer number. | In Logistic Regression, we predict the value by 1 or 0. |
4. | Here no activation function is used. | Here activation function is used to convert a linear regression equation to the logistic regression equation |
5. | Here no threshold value is needed. | Here a threshold value is added. |
6. | Here we calculate Root Mean Square Error(RMSE) to predict the next weight value. | Here we use precision to predict the next weight value. |
7. | Here dependent variable should be numeric and the response variable is continuous to value. | Here the dependent variable consists of only two categories. Logistic regression estimates the odds outcome of the dependent variable given a set of quantitative or categorical independent variables. |
8. | It is based on the least square estimation. | It is based on maximum likelihood estimation. |
9. | Here when we plot the training datasets, a straight line can be drawn that touches maximum plots. | Any change in the coefficient leads to a change in both the direction and the steepness of the logistic function. It means positive slopes result in an S-shaped curve and negative slopes result in a Z-shaped curve. |
10. | Linear regression is used to estimate the dependent variable in case of a change in independent variables. For example, predict the price of houses. | Whereas logistic regression is used to calculate the probability of an event. For example, classify if tissue is benign or malignant. |
11. | Linear regression assumes the normal or gaussian distribution of the dependent variable. | Logistic regression assumes the binomial distribution of the dependent variable. |
12. |
Applications of linear regression:
|
Applications of logistic regression:
|