返回信息流很久之前面试时被问到的问题,当时问的是LR的分类效果为什么比SVM差,面试官的当时提示说损失函数,也没有回答出来。今天突然想到这个问题,从损失函数的角度来看,怎么说明LR比SVM效果差?或者说,各个损失函数和0-1损失函数之间的区别可以推测出算法哪些特征?
这是一条镜像帖。来源:北邮人论坛 / ml-dm / #18541同步于 2016/2/26
该镜像源已超过 30 天没有更新,可能在源站已被删除。
ML_DM机器人发帖
关于损失函数的问题
hyx2011
2016/2/26镜像同步20 回复
订阅后,新回复会通过你的通知中心匿名送达。
9 条回复
google一下比较好:
Logistic Regression and SVM:你会得到很多信息。
https://www.quora.com/Support-Vector-Machines/What-is-the-difference-between-Linear-SVMs-and-Logistic-Regression
In short, they have different objectives. Logistic regression finds a classifier which maximizes the conditional likelihood of the training data. SVM maximizes the margin between points closest to the classification boundary.
Additionally, SVMs only consider points near the margin (support vectors). Logistic regression considers all the points in the data set. Which you prefer depends on your problem.
Logistic regression is great in a low number of dimensions and when the predictors don't suffice to give more than a probabilistic estimate of the response. SVMs do better when there's a higher number of dimensions, and especially on problems where the predictors do certainly (or near-certainly) determine the responses.
Non-regularized logistic regression techniques don't work well (in fact, the fitted coefficients diverge) when there's a separating hyperplane, because the maximum likelihood is achieved by any separating plane, and there's no guarantee that you'll get the best one. What you get is an extremely confident model with poor predictive power near the margin.
They are pretty similar - in the sense that they often have similar performance on the same dataset, they are both linear and they are quite easy to scale to handle large datasets.
However the way you arrive at the solution is different for SVM and Logistic Regression: SVM tries to find the widest possible separating margin, while Logistic Regression optimizes the log likelihood function, with probabilities modeled by the sigmoid function.
I think if you use the search on Quora, you'll find tons of good answers about each.
【 在 hyx2011 的大作中提到: 】
: 很久之前面试时被问到的问题,当时问的是LR的分类效果为什么比SVM差,面试官的当时提示说损失函数,也没有回答出来。今天突然想到这个问题,从损失函数的角度来看,怎么说明LR比SVM效果差?
=。=我当然是google之后再问的,貌似没有看到从损失函数角度回答的,所以我才问从损失函数的角度看两者的区别。
【 在 jasonchi 的大作中提到: 】
: google一下比较好:
: Logistic Regression and SVM:你会得到很多信息。
: https://www.quora.com/Support-Vector-Machines/What-is-the-difference-between-Linear-SVMs-and-Logistic-Regression
: ...................
我个人觉得求Decision boundary的时候,svm只是考虑支持向量,而不受数据分布的影响。但是lr所有数据对其都有贡献,因此如果分类样本不平衡的话,lr要受较大影响。但是svm和lr的选择还是要具体看样本的个数和维度的吧,单纯的说哪个更好太过绝对。
不看数据的分布去谈哪个模型好当然没有意义,只是想讨论损失函数的问题
【 在 ayzmkk 的大作中提到: 】
: 我个人觉得求Decision boundary的时候,svm只是考虑支持向量,而不受数据分布的影响。但是lr所有数据对其都有贡献,因此如果分类样本不平衡的话,lr要受较大影响。但是svm和lr的选择还是要具体看样本的个数和维度的吧,单纯的说哪个更好太过绝对。
我不是从损失函数的角度去谈了吗
【 在 hyx2011 的大作中提到: 】
: 不看数据的分布去谈哪个模型好当然没有意义,只是想讨论损失函数的问题
: 【 在 ayzmkk 的大作中提到: 】
: : 我个人觉得求Decision boundary的时候,svm只是考虑支持向量,
: .........