实现线性二进制SVM(支持向量机) [英] Implementing a linear, binary SVM (support vector machine)
问题描述
在高维二进制数据(文本)的情况下,我想实现一个简单的SVM分类器,对此,我认为简单的线性SVM最好.我自己实现它的原因基本上是我想学习它的工作原理,所以使用库不是我想要的.
I want to implement a simple SVM classifier, in the case of high-dimensional binary data (text), for which I think a simple linear SVM is best. The reason for implementing it myself is basically that I want to learn how it works, so using a library is not what I want.
问题在于,大多数教程都采用了一个方程式,可以将其作为二次方程式"解决,但它们从未展示出实际的算法!因此,您能指出我可以学习的一个非常简单的实现,还是(更好地)指向一个通向实现细节的教程?
The problem is that most tutorials go up to an equation that can be solved as a "quadratic problem", but they never show an actual algorithm! So could you point me either to a very simple implementation I could study, or (better) to a tutorial that goes all the way to the implementation details?
非常感谢!
推荐答案
顺序最小优化(SMO)方法的一些伪代码可以在John C. Platt的论文中找到: 支持向量机的快速培训使用顺序最小优化 .还有SMO算法的Java实现,该Java实现是出于研究和教育目的而开发的( SVM-JAVA ).
Some pseudocode for the Sequential Minimal Optimization (SMO) method can be found in this paper by John C. Platt: Fast Training of Support Vector Machines using Sequential Minimal Optimization. There is also a Java implementation of the SMO algorithm, which is developed for research and educational purpose (SVM-JAVA).
解决QP优化问题的其他常用方法包括:
Other commonly used methods to solve the QP optimization problem include:
- 约束共轭梯度
- 内点法
- 活动集方法
但是请注意,需要一些数学知识才能理解这些内容(拉格朗日乘数,Karush–Kuhn–Tucker条件等).
But be aware that some math knowledge is needed to understand this things (Lagrange multipliers, Karush–Kuhn–Tucker conditions, etc.).
这篇关于实现线性二进制SVM(支持向量机)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!