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

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

问题描述

当我们必须预测

  • 结果

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

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

  • 因变量

    当响应变量本质上是分类变量时,使用逻辑回归.例如,是/否、真/假、红/绿/蓝、第 1/2/3/4 等

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

  • 方程

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

    然而,逻辑回归给出了一个方程,其形式为Y = eX + e-X

  • 系数解释

    在线性回归中,自变量的系数解释非常简单(即保持所有其他变量不变,随着该变量的单位增加,因变量预计增加/减少xxx).

    然而,在逻辑回归中,取决于族(二项式、泊松、等)和链接(log、logit、inverse-log等)你用的,解释不一样.

  • 误差最小化技术

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

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

    逻辑回归正好相反.使用逻辑损失函数会导致大错误被惩罚为渐近常数.

    考虑对分类 {0, 1} 结果进行线性回归,看看为什么会出现这个问题.如果您的模型预测结果是 38,那么当真相是 1 时,您就没有损失任何东西.线性回归会尝试减少 38,logistic 不会(尽可能多)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天全站免登陆