美文网首页
Error vs. Loss 误差函数和损失函数的区别

Error vs. Loss 误差函数和损失函数的区别

作者: ericlan | 来源:发表于2020-02-19 23:16 被阅读0次

    机器学习中我们经常提到“最小化损失(loss)函数”,也经常谈到比如均方误差函数(MSE),那么loss是error的同义词吗,他们之间有什么不同?

    (这里引用英文原文大家感受一下)

    Error

    Error is the difference between the actual / true value \theta and the predicted / estimated value \hat{\theta}.

    Loss

    Loss is a measurement of how well a model fits the 'data'. The difference is what 'data' means.

    Loss (L) is a measurement of how well our model perform against your training data. You calculate loss using a loss function, many of which uses error in its equation.

    以下是一些常见的loss函数:

    • [Mean Absolute Error (MAE)] - average of the errors

    L = \frac{1}{n}\sum_{k=1}^{n}|\theta-\hat{\theta}|

    • [Mean Squared Error (MSE)]
      L = \frac{1}{n}\sum_{k=1}^{n}{(\theta-\hat{\theta})}^2

    • L_p - MAE and MSE apply a power of 1 and 2 to the errors, respectively, and averages them. Because of this, they are also called L1 and L2 loss functions. However, you can apply higher (or negative) powers, or p, to the errors.
      L = \frac{1}{n}\sum_{k=1}^{n}{|\theta-\hat{\theta}|}^p

    同时error仅仅简单表示\theta\hat{\theta}的差值,它的定义是不变的,loss值却是根据你选择的loss函数(根据选择而不同,看你怎么定义)。而如何选择loss函数取决于你的数据和目标。比如,MAE或者说L1,对于离群值很敏感,因此如果你的模型时对离群值敏感,那么你可以选择MAE。

    比较

    error总体上涉及真实值对于预测值或者期望值的偏离,而loss是一个关于模型产生误差的程度的量化方法,它是由不准确的预测所导致的负面结果,产生的误差一定程度上也是和预测\期望值相关。

    一个error函数衡量观测值对于预测值得偏差程度,而loss函数基于error操作来量化error导致的负面影响程度。比如,在一些情境下,error带来的负面后果是与error的平方成比例——所以此时可以使用均方误差来量化它。在另外一些情况下,负面后果也许受到到error方向的影响(比如false positive vs. false negative)因此我们将采用非对称的loss函数来量化。

    error函数完全是一个统计学对象,而loss函数是一个理论决定对象——我们将用它来量化error的负面效果。后者常应用在决策理论和经济学上。

    参考资料

    1. What's the difference between Error, Risk and Loss?

    2. What is the difference between a loss function and an error function?

    相关文章

      网友评论

          本文标题:Error vs. Loss 误差函数和损失函数的区别

          本文链接:https://www.haomeiwen.com/subject/zfbzfhtx.html