线性回归和逻辑回归之间有什么区别? [英] What is the difference between linear regression and logistic regression?

查看:550
本文介绍了线性回归和逻辑回归之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

然后,两种方法有什么区别?

解决方案

  • 线性回归输出作为概率

    使用线性回归输出作为概率很诱人,但这是一个错误,因为输出可以是负数,大于1而概率不能.由于回归实际上可能 产生的概率可能小于0,甚至大于 1,介绍了逻辑回归.

    来源: http://gerardnico.com/wiki/data_mining/simple_logistic_regression

  • 结果

    在线性回归中,结果(因变量)是连续的. 它可以具有无限数量的可能值中的任何一个.

    在逻辑回归中,结果(因变量)只有有限数量的可能值.

  • 因变量

    当响应变量本质上是分类时,将使用逻辑回归.例如,是/否,是/否,红色/绿色/蓝色, 1st/2nd/3rd/4th,等等

    当您的响应变量是连续的时,将使用线性回归.例如,体重,身高,小时数等.

  • 方程式

    线性回归给出的方程式为Y = mX + C, 表示度数为1的方程.

    但是,逻辑回归给出的方程式为 Y = e X + e -X

  • 系数解释

    在线性回归中,自变量的系数解释非常简单(即,使所有其他变量保持不变,并且此变量增加一个单位,则因变量预计将增加/减少xxx).

    但是,在逻辑回归中,取决于家庭(二项式,泊松, 等)和您使用的链接(log,logit,inverse-log等),其解释是不同的.

  • 最小化错误技术

    线性回归使用普通最小二乘法方法来最小化 错误并达到最佳拟合,同时进行逻辑回归 使用最大似然方法得出解决方案.

    线性回归通常是通过将模型的最小二乘误差最小化来解决的,因此大误差将被二次惩罚.

    逻辑回归正好相反.使用logistic损失函数会导致将较大的误差惩罚为渐近常数.

    考虑对分类{0,1}的结果进行线性回归,以了解为什么会出现此问题.如果您的模型预测结果为38,那么当真值为1时,您什么也不会损失.线性回归会尝试减少38,而后勤不会(尽可能) 2 .

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 outcome given the input values.

Then, what is the difference between the two methodologies?

解决方案

  • 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.

这篇关于线性回归和逻辑回归之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆