当我们必须预测分类(或离散)结果的值时,我们使用逻辑回归。我相信我们使用线性回归来预测给定输入值的结果值。
那么,这两种方法有什么不同呢?
当我们必须预测分类(或离散)结果的值时,我们使用逻辑回归。我相信我们使用线性回归来预测给定输入值的结果值。
那么,这两种方法有什么不同呢?
当前回答
| Basis | Linear | Logistic |
|-----------------------------------------------------------------|--------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| Basic | The data is modelled using a straight line. | The probability of some obtained event is represented as a linear function of a combination of predictor variables. |
| Linear relationship between dependent and independent variables | Is required | Not required |
| The independent variable | Could be correlated with each other. (Specially in multiple linear regression) | Should not be correlated with each other (no multicollinearity exist). |
其他回答
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.
逻辑回归是一种分类技术。不要被术语回归所误导。这里我们预测y=0还是1。
在这里,我们首先需要从下面的公式中找出给定x的p(y=1) (y=1的w概率)。
概率p通过下面的公式与y相关
Ex=我们可以将患癌几率超过50%的肿瘤分类为1,将患癌几率低于50%的肿瘤分类为0。
这里红点被预测为0,而绿点被预测为1。
基本区别:
线性回归基本上是一个回归模型,这意味着它将给出一个函数的非离散/连续输出。这个方法给出了值。例如,给定x, f(x)是多少
例如,给定一个由不同因素组成的训练集和训练后的房地产价格,我们可以提供所需的因素来确定房地产价格。
逻辑回归基本上是一种二元分类算法,这意味着这里函数的输出值是离散的。例如:对于给定的x,如果f(x)>阈值将其分类为1,否则将其分类为0。
例如,给定一组脑瘤大小作为训练数据,我们可以使用大小作为输入来确定它是良性肿瘤还是恶性肿瘤。因此这里的输出不是0就是1。
这里的函数基本上是假设函数
线性回归和逻辑回归的基本区别是: 线性回归用于预测一个连续的或数值,但当我们寻找预测一个值,是分类逻辑回归进入画面。
二元分类采用逻辑回归。
简而言之: 线性回归给出连续的输出。即在一个值范围内的任何值。 逻辑回归给出离散的输出。即Yes/No, 0/1类型的输出。
简单地说,线性回归是一种回归算法,它输出一个可能连续和无限的值;逻辑回归被认为是一种二进制分类器算法,它输出输入属于标签(0或1)的“概率”。