SVM分类器中的超平面 [英] Hyperplane in SVM classifier
问题描述
我想在SVM分类器中获得关于超平面的公式,
I want to get a formula for hyperplane in SVM classifier,
所以我可以根据距超平面的距离来计算每个样本的真实分类概率.
so I can calculate the probability of true classification for each sample according to distance from hyperplane.
为简单起见,想象一下MATLAB自己的示例,
For simplicity imagine MATLAB's own example,
load fisheriris
xdata = meas(51:end,3:4);
group = species(51:end);
svmStruct = svmtrain(xdata,group,'showplot',true);
哪个给
超平面是一条线,而我要用它的公式.
Where the hyperplane is a line and I want the formula for that.
超平面也可能具有凌乱的形状!
The hyperplane can also have a messy shape!
我该怎么办?也许还有其他方法.
What can I do? maybe there are other ways.
感谢您的帮助.
推荐答案
基于SVM的分类器包含支持向量
要更轻松地从 svmStruct
阅读它,请对 "AUTOSCALE"
, false
:
SVM-based classifier contains Support Vectors
to read it from svmStruct
a bit more easily, use svmtrain
call with "AUTOSCALE"
, false
:
svmStruct.SupportVectors
svmStruct =
SupportVectors: [3x2 double]
Alpha: [3x1 double]
Bias: -23.1428
KernelFunction: @linear_kernel
KernelFunctionArgs: {}
GroupNames: [150x1 logical]
SupportVectorIndices: [3x1 double]
ScaleData: []
FigureHandles: {[170.0012] [171.0052 172.0018] [225.0018]}
ans =
5.5000 3.5000
4.5000 2.3000
4.9000 2.5000
或
>> data( svmStruct.SupportVectorIndices,: )
ans =
5.5000 3.5000
4.5000 2.3000
4.9000 2.5000
如果使用默认的' autoscale
'选项,则需要使用类似以下这样的丑陋方法来取消缩放比例:
If you use the default 'autoscale
' option, then you will need to unwind the scaling using something rather ugly like this:
( data( svmStruct.SupportVectorIndices( 1 ),: )
+ svmStruct.ScaleData.shift
).* svmStruct.ScaleData.scaleFactor
(>>> https://www.mathworks.com/matlabcentral/newsreader /view_thread/249055 )
对于从SVM分类器内部数据构建分离的Hyperplane,您可能感兴趣>>> http://scikit-learn.org/stable/auto_examples/svm/plot_separating_hyperplane.html
For construction of a separating Hyperplane from SVM-classifier internal data, you may be interested in >>> http://scikit-learn.org/stable/auto_examples/svm/plot_separating_hyperplane.html
使用线性核支持向量机分类器在两类可分离数据集中绘制最大余量分离超平面的参数
Parameters for to plot the maximum margin separating hyperplane within a two-class separable dataset using a Support Vector Machines classifier with linear kernel
这篇关于SVM分类器中的超平面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!