码迷,mamicode.com
首页 > 其他好文 > 详细

支持向量机

时间:2015-11-16 21:09:24      阅读:294      评论:0      收藏:0      [点我收藏+]

标签:

Support Vector Machines are an optimization problem. They are attempting to find a hyperplane that divides the two classes with the largest margin. The support vectors are the points which fall within this margin. It‘s easiest to understand if you build it up from simple to more complex.

支持向量机是一个优化问题。他们(这些点)企图去找到一个超平面以一个最大的距离(2/||W||)去划分两个类。支持向量就是那些落在边缘(下图虚线)上的点。

Hard Margin Linear SVM

硬间隔线性支持向量机(训练样本线性可分时)

In an a training set where the data is linearly separable, and you are using a hard margin (no slack allowed), the support vectors are the points which lie along the supporting hyperplanes (the hyperplanes parallel to the dividing hyperplane at the edges of the margin)

在一个训练集中,这里的数据是线性可分的,并且你可以用一个严格(hard)的间隔去把他们分成两类(不允许使那些点逃离到两个虚线中间),分离超平面(实线)平行于那两个边缘分割超屏幕(虚线)。边缘加粗的点就是支持向量。

技术分享

All of the support vectors lie exactly on the margin. Regardless of the number of dimensions or size of data set, the number of support vectors could be as little as 2.

所有的支持向量都精确的落在边缘上。不管空间的维度有多大,或者数据集合有多大,支持向量的个数一般很少,都可以像2个这么小。在决定分离超平面时,只有支持向量起着至关重要的作用,其他的点并不起作用。所以支持向量机是由这些很少的,很“重要的”训练数据决定的。

Soft-Margin Linear SVM

软间隔线性支持向量机(训练样本线性不可分时)

But what if our dataset isn‘t linearly separable? We introduce soft margin SVM. We no longer require that our datapoints lie outside the margin, we allow some amount of them to stray over the line into the margin. We use the slack parameter C to control this. (nu in nu-SVM) This gives us a wider margin and greater error on the training dataset, but improves generalization and/or allows us to find a linear separation of data that is not linearly separable.

但是如果我们的数据集合不是线性可分的怎么办?我们引入软间隔支持向量机。我们不再要求数据点落在间隔的两侧,而是允许一些点逃离出来,落在间隔里面。我们用松弛参数(惩罚参数)C去控制。(nu in nu-SVM) 这就给我一个更宽的距离和更大的错误在训练数据集合上,提高了泛化并且允许找到一个线性可分的超平面来分离这些线性不可分的数据。

技术分享

Now, the number of support vectors depends on how much slack we allow and the distribution of the data. If we allow a large amount of slack, we will have a large number of support vectors. If we allow very little slack, we will have very few support vectors. The accuracy depends on finding the right level of slack for the data being analyzed. Some data it will not be possible to get a high level of accuracy, we must simply find the best fit we can.

现在,这些支持向量依赖于我们允许的松弛程度和数据的分布。如果我们允许很大数量的松弛,我们将会得到大量的支持向量,如果我们允许很小的松弛,将会得到很少的支持向量。对分类的精确程度依赖于我们对被分析数据的松弛程度确定的正确性,因此我们必须找到最适合的松弛度。

Non-Linear SVM非线性支持向量

This brings us to non-linear SVM. We are still trying to linearly divide the data, but we are now trying to do it in a higher dimensional space. This is done via a kernel function, which of course has its own set of parameters. When we translate this back to the original feature space, the result is non-linear:

我们尝试去线性的划分这些非线性的数据,去把放在一个更高维的空间里。想要做到这点需要通过核函数,核函数会有自己的一组训练参数。当我们把这些数据还原到原始的特征空间,结果是非线性的。

技术分享

Now, the number of support vectors still depends on how much slack we allow, but it also depends on the complexity of our model. Each twist and turn in the final model in our input space requires one or more support vectors to define. Ultimately, the output of an SVM is the support vectors and an alpha, which in essence is defining how much influence that specific support vector has on the final decision.

这里的支持向量依然依赖与我们允许的松弛程度,也依赖与我们的模型复杂度。每一个迂回曲折输入空间都需要一个或者多个支持向量。最终,支持向量机的输出是这些支持向量和参数alpha,这在本质上确定了具体的支持向量对最终结果的影响程度。

Here, accuracy depends on the trade-off between a high-complexity model which may over-fit the data and a large-margin which will incorrectly classify some of the training data in the interest of better generalization. The number of support vectors can range from very few to every single data point if you completely over-fit your data. This tradeoff is controlled via C and through the choice of kernel and kernel parameters.

在这里的精确程度依赖于一个高复杂度度的模型(这会产生过拟合)和一个很大的距离之间的权衡。支持向量的数量范围可以从很少到每一个数据点,如果你完全过拟合数据。这种权衡是通过参数C和内核参数的选择来控制的。

I assume when you said performance you were referring to accuracy, but I thought I would also speak to performance in terms of computational complexity. In order to test a data point using an SVM model, you need to compute the dot product of each support vector with the test point. Therefore the computational complexity of the model is linear in the number of support vectors. Fewer support vectors means faster classification of test points.

不光要考虑分类精确度,还要考虑计算复杂度。为了使用SVM模型来检验一个数据点,你需要计算与测试点的每个支持向量的点积。因此该模型的计算复杂性是支持向量的数目。较少的支持向量可以更快的分类测试数据。

支持向量机

标签:

原文地址:http://www.cnblogs.com/ldphoebe/p/4965142.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!