支持向量机回归和支持向量机

Support Vector Machine(SVM) is a supervised machine learning algorithm that is usually used in solving binary classification problems. It can also be applied in multi-class classification problems and regression problems. This article represents the mathematics behind the binary-class linear Support Vector Machines. Understanding mathematics helps implement and tune the models in practice. Moreover, you can build your own support vector machine model from scratch, and compare it with the one from Scikit-Learn. For details, you can read this article along with another article of mine.

支持向量机(SVM)是一种监督型机器学习算法,通常用于解决二进制分类问题。 它也可以应用于多类分类问题和回归问题。 本文介绍了二元类线性支持向量机背后的数学原理。 了解数学有助于在实践中实现和调整模型。 此外,您可以从头开始构建自己的支持向量机模型,并将其与Scikit-Learn的模型进行比较。 有关详细信息,您可以阅读本文以及我的另一篇文章。

Specifically, this report explains the key concepts of linear support vector machine, including the primal form and its dual form for both hard margin and soft margin case; the concept of support vectors, max-margin, and the generalization process.

具体而言,本报告解释了线性支持向量机的关键概念,包括硬边际和软边际情况的原始形式及其对偶形式; 支持向量,最大边距和归纳过程的概念。

Key Concepts of SVM

SVM的关键概念

Assume we have n training points, each observation i has p features (i.e. x_i has p dimensions), and is in two classes y_i=-1 or y_i = 1. Suppose we have two classes of observations that are linearly separable. That means we can draw a hyperplane through our feature space such that all instances of one class are on one side of the hyperplane, and all instances of the other class are on the opposite side. (A hyperplane in p dimensions is a p-1 dimensional subspace. In the two-dimensional example that follows, a hyperplane is just a line.) We define a hyperplane as:

假设我们有n个训练点,每个观测值i具有p个特征(即x_i具有p个维),并且处于两类y_i = -1或y_i =1。假设我们有两类线性可分离的观测值。 这意味着我们可以在特征空间中绘制一个超平面,这样一类的所有实例都在超平面的一侧,而另一类的所有实例都在另一侧。 (p维上的超平面是p-1维子空间。在下面的二维示例中,超平面只是一条线。)我们将超平面定义为:

where ˜w is a p-vector and ˜b is a real number. For convenience, we require that ˜w = 1, so the quantity x * ˜w + ˜b is the distance from point x to the hyperplane.

其中〜w是p向量,〜b是实数。 为了方便起见,我们要求〜w = 1,所以数量x *〜w +〜b是从点x到超平面的距离。

image from Wikipedia
图片来自维基百科

Thus we can label our classes with y = +1/-1, and the requirement that the hyperplane divides the classes becomes:

因此,我们可以用y = + 1 / -1标记我们的类,超平面划分这些类的要求变为:

How should we choose the best hyperplane?

我们应该如何选择最佳的超平面?

The approach to answering this question is to choose the plane that results in the largest margin M between the two classes, which is called the Maximal Margin Classifier.

回答此问题的方法是选择在两个类别之间产生最大边距M的平面,这称为最大边距分类器。

image from Wikipedia
图片来自维基百科

From the previous graph, we can see that H1 doesn’t separate the two classes; for H2 and H3, we will choose H3 because H3 has a larger margin. Mathematically, we choose ˜b and ˜w to maximize M, given the constraints:

从上一张图中,我们可以看到H1并没有将这两个类别分开。 对于H2和H3,我们将选择H3,因为H3具有较大的边距。 在数学上,给定约束,我们选择〜b和〜w以最大化M:

Defining w =˜ w / M and b =˜b / M, we can rewrite this as:

定义w = 〜w / Mb =〜b / M ,我们可以重写为:

and

The support vectors

支持向量

The support vectors are the data points that lie closest to the separating hyperplane. They are the most difficult data points to classify. Moreover, support vectors are the elements of the training set that would change the position of the dividing hyperplane if removed. The optimization algorithm to generate the weights proceeds in such a way that only the support vectors determine the weights and thus the boundary. Mathematically support vectors are defined as:

支持向量是最靠近分离超平面的数据点。 它们是最难分类的数据点。 此外,支持向量是训练集的元素,如果被移除,它们将改变划分超平面的位置。 生成权重的优化算法以这样的方式进行:只有支持向量才能确定权重,从而确定边界。 数学上的支持向量定义为:

Hard-margin SVM

硬利润支持向量机

The hard-margin SVM is very strict with the support vectors crossing the hyperplane. It doesn’t allow any support vectors to be classified in the wrong class. To maximize the margin of the hyperplane, the hard-margin support vector machine is facing the optimization problem:

硬边支持向量机非常严格,支持向量跨过超平面。 不允许将任何支持向量分类为错误的类。 为了最大化超平面的余量,硬余量支持向量机面临着优化问题:

Soft-margin SVM and the hyper-parameter C

软边距SVM和超参数C

In general, classes are not linearly separable. This may be because the class boundary is not linear, but often there is no clear boundary. To deal with this case, the support vector machine adds a set of “slack variables”, which forgive excursions of a few points into, or even across, the margin, like showing in the graph below:

通常,类不是线性可分离的。 这可能是因为类边界不是线性的,但是通常没有明确的边界。 为了解决这种情况,支持向量机添加了一组“松弛变量”,这些宽恕原谅了到边缘甚至跨越边缘的几个点的偏移,如下图所示:

image by Author
图片作者

We want to minimize the total amount of slacks while maximizing the width of the margin, which is called soft-margin support vector machine. This is more widely used, and the objective function becomes:

我们要在使边距的宽度最大的同时,使松弛的总量最小化,这称为软边距支持向量机。 这被更广泛地使用,目标函数变为:

for some constant C. This optimization problem is called the primal problem. The constant C represents the “cost” of the slack. When C is small, it is efficient to allow more points into the margin to achieve a larger margin. Larger C will produce boundaries with fewer support vectors. By increasing the number of support vectors, SVM reduces its variance, since it depends less on any individual observation. Reducing variance makes the model more generalized. Thus, decreasing C will increase the number of support vectors and reduce over-fitting.

对于一些常数C。 此优化问题称为原始问题。 常数C代表松弛的“成本”。 当C较小时,允许有更多点进入边距以实现更大的边距是有效的。 C越大,边界越少,支持向量也越少。 通过增加支持向量的数量,SVM减少了方差,因为它较少依赖于任何单独的观察。 减少方差使模型更通用。 因此,降低C将增加支持向量的数量并减少过度拟合。

With Lagrange multipliers:

使用拉格朗日乘数:

two constraints
两个约束

we can rewrite the constrained optimization problem as the primal Lagrangian function :

我们可以将约束优化问题重写为原始拉格朗日函数:

Instead of minimizing over w, b, subject to constraints, we can maximize over the multipliers subject to the relations obtained previously for w, b. This is called the dual Lagrangian formulation:

代替将wb最小化(受约束),我们可以使乘数最大化,该乘数受先前为wb获得的关系的约束。 这称为双重拉格朗日公式:

This is now a reasonably straightforward quadratic programming problem, solved with Sequential Minimization Optimization. There are a lot of programming tools you can use to solve the optimizing problem. You can use the CVX tool in Matlab to solve this question. Or if you are familiar with python, you can use the CVXOPT package to solve it. I have another article at Medium that discusses the use of the CVXOPT package, and how to apply it to solve SVM in the dual formulation. Once we have solved this problem for \alpha, we can easily work out the coefficients:

现在这是一个相当简单的二次规划问题,可通过顺序最小化优化解决。 您可以使用许多编程工具来解决优化问题。 您可以使用Matlab中的CVX工具来解决此问题。 或者,如果您熟悉python,则可以使用CVXOPT软件包来解决它。 我在Medium上还有另一篇文章,讨论了CVXOPT软件包的用法,以及如何将其应用于对偶公式中的SVM解决方案。 解决\ alpha的问题后,我们可以轻松计算出系数:

Waling through the math behind the Support Vector Machines algorithm definitely helps understand the implementation of the model. It gives insights on choosing the right model for the right questions and choosing the right value for the hyper-parameters.

仔细阅读支持向量机算法背后的数学知识,无疑有助于理解模型的实现。 它为选择正确的问题模型和为超参数选择正确的值提供了见解。

Hope this helps. Thank you all for reading!

希望这可以帮助。 谢谢大家的阅读!

翻译自: https://towardsdatascience.com/explain-support-vector-machines-in-mathematic-details-c7cc1be9f3b9

支持向量机回归和支持向量机


http://www.taodudu.cc/news/show-3765486.html

相关文章:

  • python支持向量机回归_支持向量机回归的Scikitlearn网格搜索
  • 基于麻雀搜索算法优化的支持向量机回归预测-附代码
  • 【项目实战】Python实现支持向量机SVM回归模型(SVR算法)项目实战
  • 美国高校EECS方向相关情况
  • HeadFir st 设计模式学习笔记8--模板方法模式
  • 【Python】python练习
  • 微信内置浏览器 非全屏播放视频解析
  • 《js中原型和原型链的深入理解》的笔记
  • []转载]微信内置浏览器 非全屏播放视频解析
  • 【Linux】将Oracle安装目录从根目录下迁移到逻辑卷
  • JS 中原型和原型链深入理解
  • 动态系统建模-状态空间方程
  • matlab由状态空间求传递函数,matlab 由状态空间表达式求传递函数 [李园7舍_404]
  • matlab状态空间程序,将状态空间表示形式转换为传递函数
  • 遇到mybatis面试问题应该怎么回答
  • 2019-mybatis面试题
  • 【mybatis】mybatis面试题
  • Mybatis面试题集锦 那些经常问到的Mybatis面试30题
  • mybatis面试
  • mybatis面试相关
  • 无门无派 程序员整理的32个MyBatis面试专题。(都是干货)
  • 面试遇到MyBatis不要慌,看看这篇文章
  • Quarts 执行定时任务失败(.job.entity.ScheduleJobEntity cannot be cast to com.)
  • 定时任务的框架 quarts
  • QuartsII-基于VHDL的设计以及基于VHDL和原理图的混合设计
  • 初窥Quarts2D(二)
  • java性能优化之三 优雅平滑的结束quarts 任务
  • quarts集群 运维_定时任务之Quartz和Elastic-Job
  • [原创] 在spring 中使用quarts
  • quarts集群 运维_分布式定时任务调度系统技术解决方案(xxl-job、Elastic-job、Saturn)...

支持向量机回归和支持向量机_详细解释支持向量机相关推荐

  1. python鸭制作类代码_详细解释ducktyping鸭子类型程序设计与Python的实现

    在程序设计中,鸭子类型(英语:duck typing)是动态类型的一种风格.在这种风格中,一个对象有效的语义,不是由继承自特定的类或实现特定的接口,而是由当前方法和属性的集合决定. 这个概念的名字来源 ...

  2. 回归预测 | MATLAB实现SVR(支持向量机回归)多输入多输出

    回归预测 | MATLAB实现SVR(支持向量机回归)多输入多输出 目录 回归预测 | MATLAB实现SVR(支持向量机回归)多输入多输出 预测效果 基本介绍 程序设计 参考资料 预测效果 基本介绍 ...

  3. 支持向量机回归_机器学习系列17:支持向量机

    机器学习系列17:支持向量机 支持向量机(Support vector machine)是一种强大的机器学习算法,和神经网络相比,它在学习复杂的非线性方程时,能够提供更清晰和更加强大的方式.为了学习支 ...

  4. python svr回归_机器学习入门之机器学习之路:python支持向量机回归SVR 预测波士顿地区房价...

    本文主要向大家介绍了机器学习入门之机器学习之路:python支持向量机回归SVR  预测波士顿地区房价,通过具体的内容向大家展现,希望对大家学习机器学习入门有所帮助. 支持向量机的两种核函数模型进行预 ...

  5. python支持向量机回归_支持向量机回归的Scikitlearn网格搜索

    我正在学习交叉验证网格搜索,并遇到了这个youtube playlist,教程也作为ipython笔记本上传到了github.我试图在同时搜索多个参数部分重新创建代码,但我使用的不是knn,而是支持向 ...

  6. Python实现ALO蚁狮优化算法优化支持向量机回归模型(SVR算法)项目实战

    说明:这是一个机器学习实战项目(附带数据+代码+文档+视频讲解),如需数据+代码+文档+视频讲解可以直接到文章最后获取. 1.项目背景 蚁狮优化(Ant Lion Optimizer,ALO)算法是M ...

  7. SVM支持向量机的推导(非常详细)

    SVM支持向量机的推导(非常详细) 参考自(https://www.zhihu.com/search?q=svm%E6%8E%A8%E5%AF%BC&utm_content=search_su ...

  8. Python实现贝叶斯优化器(Bayes_opt)优化支持向量机回归模型(SVR算法)项目实战

    说明:这是一个机器学习实战项目(附带数据+代码+文档+视频讲解),如需数据+代码+文档+视频讲解可以直接到文章最后获取. 1.项目背景 贝叶斯优化器 (BayesianOptimization) 是一 ...

  9. Python实现WOA智能鲸鱼优化算法优化支持向量机回归模型(LinearSVR算法)项目实战

    说明:这是一个机器学习实战项目(附带数据+代码+文档+视频讲解),如需数据+代码+文档+视频讲解可以直接到文章最后获取. 1.项目背景 鲸鱼优化算法 (whale optimization algor ...

最新文章

  1. 深度学习中的3个秘密:集成、知识蒸馏和蒸馏
  2. 2019年雁栖湖会议重大科学问题面向全球发布
  3. [Linux]阿里云免费试用体验(在阿里云的ubuntu上部署个人服务)
  4. nrf52832 DFU详细步骤 SDK13
  5. jquery总结_代码收藏
  6. 本地计算机上的OracleOraDb11g_home2TNSListener服务启动又停止了。一些服务自动停止,如果他们没有什么可做的 ....
  7. [译]如何在visual studio中调试Javascript
  8. 字符串p型编码(信息学奥赛一本通-T1145)
  9. 论文阅读01:大规模人脸图像检索的深度度量哈希
  10. C#实现重新启动计算机
  11. 26. 复杂链表的复制
  12. 韩顺平Scala精讲 最强Scala 教学视频!
  13. 米哈游web前端面试题Js/Vue/浏览器原理等
  14. 博科Brocade 300光纤交换机配置zone教程
  15. 2019当今互联网赚钱的六大方式,赠送给迷茫的网赚新手
  16. 【React】1332- 2022 年值得推荐的 React 库
  17. Mac中使用Mounty对NTFS文件进行读写操作,报错“卷不能在读/写模式下重新挂载,可能是因为先前没有完全卸载(安全删除)”问题的解决
  18. 利用JAVA的BFS爬虫爬出豆瓣读书的评论和标签
  19. svg实现圆环倒计时动画效果
  20. 沟通和编程一样,也是一门艺术系列1(最佳的沟通态度)

热门文章

  1. 【牛客网】 F-大吉大利,今晚吃鸡——跑毒篇
  2. 使用uniapp在微信小程序改变v-model里面的值,视图不更新的解决方案
  3. Matlab实现姿态角变化可视化实时显示
  4. ffmpeg转码生成的m3u8格式详解
  5. iOS之LCWebView(和并UIWebView和WKWebView,兼容iOS7及以上)
  6. P2P直播、点播技术学习经验
  7. 最简单最浪漫的七夕表白效果——上代码
  8. 程序员如何打造自己的影响力
  9. Weblogic 常见漏洞汇总
  10. ios拒审4.3 python自动生成辣鸡代码