What is the difference between linear regression and logistic regression?

后端 未结 15 1313
一向
一向 2020-12-02 03:32

When we have to predict the value of a categorical (or discrete) outcome we use logistic regression. I believe we use linear regression to also predict the value of an outco

相关标签:
15条回答
  • 2020-12-02 04:11

    Regression means continuous variable, Linear means there is linear relation between y and x. Ex= You are trying to predict salary from no of years of experience. So here salary is independent variable(y) and yrs of experience is dependent variable(x). y=b0+ b1*x1 We are trying to find optimum value of constant b0 and b1 which will give us best fitting line for your observation data. It is a equation of line which gives continuous value from x=0 to very large value. This line is called Linear regression model.

    Logistic regression is type of classification technique. Dnt be misled by term regression. Here we predict whether y=0 or 1.

    Here we first need to find p(y=1) (wprobability of y=1) given x from formuale below.

    Probaibility p is related to y by below formuale

    Ex=we can make classification of tumour having more than 50% chance of having cancer as 1 and tumour having less than 50% chance of having cancer as 0.

    Here red point will be predicted as 0 whereas green point will be predicted as 1.

    0 讨论(0)
  • 2020-12-02 04:12

    The basic difference :

    Linear regression is basically a regression model which means its will give a non discreet/continuous output of a function. So this approach gives the value. For example : given x what is f(x)

    For example given a training set of different factors and the price of a property after training we can provide the required factors to determine what will be the property price.

    Logistic regression is basically a binary classification algorithm which means that here there will be discreet valued output for the function . For example : for a given x if f(x)>threshold classify it to be 1 else classify it to be 0.

    For example given a set of brain tumour size as training data we can use the size as input to determine whether its a benine or malignant tumour. Therefore here the output is discreet either 0 or 1.

    *here the function is basically the hypothesis function

    0 讨论(0)
  • 2020-12-02 04:12

    Cannot agree more with the above comments. Above that, there are some more differences like

    In Linear Regression, residuals are assumed to be normally distributed. In Logistic Regression, residuals need to be independent but not normally distributed.

    Linear Regression assumes that a constant change in the value of the explanatory variable results in constant change in the response variable. This assumption does not hold if the value of the response variable represents a probability (in Logistic Regression)

    GLM(Generalized linear models) does not assume a linear relationship between dependent and independent variables. However, it assumes a linear relationship between link function and independent variables in logit model.

    0 讨论(0)
提交回复
热议问题