当我们必须预测分类(或离散)结果的值时,我们使用逻辑回归。我相信我们使用线性回归来预测给定输入值的结果值。

那么,这两种方法有什么不同呢?


当前回答

在线性回归的情况下,结果是连续的,而在逻辑回归的情况下,结果是离散的(非连续的)

要执行线性回归,我们需要因变量和自变量之间的线性关系。但要执行逻辑回归,我们不需要因变量和自变量之间的线性关系。

线性回归是在数据中拟合一条直线,而逻辑回归是在数据中拟合一条曲线。

线性回归是机器学习的一种回归算法,逻辑回归是机器学习的一种分类算法。

线性回归假设因变量呈高斯(或正态)分布。逻辑回归假设因变量为二项分布。

其他回答

线性回归和逻辑回归的基本区别是: 线性回归用于预测一个连续的或数值,但当我们寻找预测一个值,是分类逻辑回归进入画面。

二元分类采用逻辑回归。

Linear regression output as probabilities It's tempting to use the linear regression output as probabilities but it's a mistake because the output can be negative, and greater than 1 whereas probability can not. As regression might actually produce probabilities that could be less than 0, or even bigger than 1, logistic regression was introduced. Source: http://gerardnico.com/wiki/data_mining/simple_logistic_regression Outcome In linear regression, the outcome (dependent variable) is continuous. It can have any one of an infinite number of possible values. In logistic regression, the outcome (dependent variable) has only a limited number of possible values. The dependent variable Logistic regression is used when the response variable is categorical in nature. For instance, yes/no, true/false, red/green/blue, 1st/2nd/3rd/4th, etc. Linear regression is used when your response variable is continuous. For instance, weight, height, number of hours, etc. Equation Linear regression gives an equation which is of the form Y = mX + C, means equation with degree 1. However, logistic regression gives an equation which is of the form Y = eX + e-X Coefficient interpretation In linear regression, the coefficient interpretation of independent variables are quite straightforward (i.e. holding all other variables constant, with a unit increase in this variable, the dependent variable is expected to increase/decrease by xxx). However, in logistic regression, depends on the family (binomial, Poisson, etc.) and link (log, logit, inverse-log, etc.) you use, the interpretation is different. Error minimization technique Linear regression uses ordinary least squares method to minimise the errors and arrive at a best possible fit, while logistic regression uses maximum likelihood method to arrive at the solution. Linear regression is usually solved by minimizing the least squares error of the model to the data, therefore large errors are penalized quadratically. Logistic regression is just the opposite. Using the logistic loss function causes large errors to be penalized to an asymptotically constant. Consider linear regression on categorical {0, 1} outcomes to see why this is a problem. If your model predicts the outcome is 38, when the truth is 1, you've lost nothing. Linear regression would try to reduce that 38, logistic wouldn't (as much)2.

在线性回归的情况下,结果是连续的,而在逻辑回归的情况下,结果是离散的(非连续的)

要执行线性回归,我们需要因变量和自变量之间的线性关系。但要执行逻辑回归,我们不需要因变量和自变量之间的线性关系。

线性回归是在数据中拟合一条直线,而逻辑回归是在数据中拟合一条曲线。

线性回归是机器学习的一种回归算法,逻辑回归是机器学习的一种分类算法。

线性回归假设因变量呈高斯(或正态)分布。逻辑回归假设因变量为二项分布。

简单地说,如果在线性回归模型中有更多的测试用例到达,这些测试用例远离预测y=1和y=0的阈值(例如=0.5)。在这种情况下,假设就会改变,变得更糟。因此,线性回归模型不适用于分类问题。

另一个问题是,如果分类是y=0和y=1, h(x)可以是> 1或< 0。因此,我们使用Logistic回归0<=h(x)<=1。

非常同意以上的评论。 除此之外,还有一些不同之处

在线性回归中,残差被假设为正态分布。 在逻辑回归中,残差需要是独立的,但不是正态分布。

线性回归假设解释变量值的恒定变化导致响应变量的恒定变化。 如果响应变量的值代表概率(在逻辑回归中),则此假设不成立。

广义线性模型(GLM)不假设因变量和自变量之间存在线性关系。但在logit模型中,它假设link函数与自变量之间是线性关系。