loss function

来源:互联网 发布:java发http get请求 编辑:程序博客网 时间:2024/05/20 09:06

机器学习中的Loss函数 


转载自:http://www.ics.uci.edu/~dramanan/teaching/ics273a_winter08/lectures/lecture14.pdf,翻译来自转载






  1. Loss Function

    损失函数可以看做 误差部分(loss term) + 正则化部分(regularization term)

1.1 Loss Term

  • Gold Standard (ideal case)
  • Hinge (SVM, soft margin)
  • Log (logistic regression, cross entropy error)
  • Squared loss (linear regression)
  • Exponential loss (Boosting)

   

Gold Standard 又被称为0-1 loss, 记录分类错误的次数

Hinge Loss http://en.wikipedia.org/wiki/Hinge_loss

For an intended output t = ±1 and a classifier score y, the hinge loss of the prediction y is defined as

Note that y should be the "raw" output of the classifier's decision function, not the predicted class label. E.g., in linear SVMs, 

It can be seen that when t and y have the same sign (meaning y predicts the right class) and 

, the hinge loss 

, but when they have opposite sign, 

increases linearly with y (one-sided error).

   

来自 <http://en.wikipedia.org/wiki/Hinge_loss>

Plot of hinge loss (blue) vs. zero-one loss (misclassification, green:y < 0) for t = 1 and variable y. Note that the hinge loss penalizes predictions y < 1, corresponding to the notion of a margin in a support vector machine.

   

来自 <http://en.wikipedia.org/wiki/Hinge_loss>

   

   

在Pegasos: Primal Estimated sub-GrAdient SOlver for SVM论文中

这里把第一部分看成正规化部分,第二部分看成误差部分,注意对比ng关于svm的课件

不考虑规则化

 

Log Loss

Ng的课件1,先是讲 linear regression 然后引出最小二乘误差,之后概率角度高斯分布解释最小误差。

然后讲逻辑回归,使用MLE来引出优化目标是使得所见到的训练数据出现概率最大

   

   

最大化下面的log似然函数

而这个恰恰就是最小化cross entropy

   

http://en.wikipedia.org/wiki/Cross_entropy

http://www.cnblogs.com/rocketfan/p/3350450.html 信息论,交叉熵与KL divergence关系

   

Cross entropy can be used to define loss function in machine learning and optimization. The true probability 

 is the true label, and the given distribution 

 is the predicted value of the current model.

More specifically, let us consider logistic regression, which (in its most basic guise) deals with classifying a given set of data points into two possible classes generically labelled 

 and 

. The logistic regression model thus predicts an output 

, given an input vector 

. The probability is modeled using thelogistic function 

. Namely, the probability of finding the output 

 is given by

where the vector of weights 

 is learned through some appropriate algorithm such as gradient descent. Similarly, the conjugate probability of finding the output 

 is simply given by

The true (observed) probabilities can be expressed similarly as 

 and 

.

   

Having set up our notation, 

 and 

, we can use cross entropy to get a measure for similarity between 

 and 

:

The typical loss function that one uses in logistic regression is computed by taking the average of all cross-entropies in the sample. For specifically, suppose we have 

 samples with each sample labeled by 

. The loss function is then given by:

where 

, with 

 the logistic function as before.

   

The logistic loss is sometimes called cross-entropy loss. It's also known as log loss (In this case, the binary label is often denoted by {-1,+1}).[1]

   

来自 <http://en.wikipedia.org/wiki/Cross_entropy>

   

   

因此和ng从MLE角度给出的结论是完全一致的! 差别是最外面的一个负号

也就是逻辑回归的优化目标函数是 交叉熵

   

squared loss

   

exponential loss

指数误差通常用在boosting中,指数误差始终> 0,但是确保越接近正确的结果误差越小,反之越大。


0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 招商银行e分期逾期怎么办 保单贷款还不了怎么办 离婚时按揭房怎么办 按揭房子不要了怎么办? 征信有问题怎么办房贷 夫妻一方不做房贷共还人怎么办 给你花逾期一年怎么办 文件夹密码忘记了怎么办 网址被qq拦截怎么办 手机qq邮箱中毒怎么办 邮箱附件带病毒怎么办? 打开了病毒附件怎么办? qq邮箱被拦截怎么办 邮件地址已被注册怎么办 信用卡欠款怎么办房贷 贷款还不起了怎么办 装修贷款无抵押怎么办 黑户买房做贷款怎么办 易分期无法还款怎么办 工行晚还款一天怎么办 手机银行网页打不开怎么办 顺丰分拣错误怎么办 超市生意越来越差怎么办 收到逾期催收函怎么办 手机贷逾期了怎么办 临额到期还不上怎么办 信用卡不想用了怎么办 授信时间到了怎么办 餐饮吃到苍蝇怎么办 商户二级处罚了怎么办 立刷蓝牙连不上怎么办 传奇3骑不了怎么办 房子说话有回音怎么办 老师声音哑了怎么办 人流后还有残留怎么办 人流后有残留物怎么办 模拟人生3外星人怎么办 模拟人生爸妈死孩子怎么办? 模拟人生3怎么办生日 圆通单号查不到怎么办 iphonex屏幕碎了怎么办