translating a support vector machine structure into explicit form

Hi
I am new to SVM classification. I am trying to write a simple function to use the SVM struct in an explicit form. however using this function to classify new data doesn't yield the same result as SVM classify so I am assuming there is an error in my function. Can you help ? Thank you
The function is:
function f=classSVMU(x)
%shift [-0.136658807090128,-0.750778068467108]
%scaling factor [18.357296677281383,23.442173000970396]
x(1)=18.357296677281383*x(1) - 0.136658807090128*18.357296677281383;
x(2)=23.442173000970396*x(2) - 0.750778068467108*23.442173000970396;
%support vectors
SV=[1.54965309761314,0.155818518919654;-1.28999123215383,0.778501239257931;0.775204644040327,0.485474076745800;1.11940395673935,0.338960495489735;1.67651386968988,0.0884428172584560;-0.223206275049718,0.929632330370693;-0.274778194249021,0.980060247398309;0.614984820217217,0.629254293785940;-0.245359128459101,0.898846902484522;-1.69540650907984,0.600598657976632;-1.03118526557023,0.753173782386330;1.02599894259038,0.319833849471352;1.04876917164531,0.281621620945848;0.944516027577421,0.358483808260766;-0.0778111902177782,0.830042432487916];
alpha=[-1.06485892316272;-0.226204522991954;0.650000000000000;-0.655214684609375;0.650000000000000;0.650000000000000;-1.54628923267320;-1.99064892883321;0.650000000000000;0.0471015326634750;0.287562832989304;0.650000000000000;0.650000000000000;0.650000000000000;0.598551926617678];
%bias
f=5.060676156772543;
for i=1:15 %15 SV
%poly kernel of order 5
f=f+alpha(i)*(SV(i,:)*x'+1)^5;
end

 Akzeptierte Antwort

Ilya
Ilya am 24 Feb. 2014

0 Stimmen

1 Kommentar

Thank you. It did work. I wanted to make a mex file out of it which does not seem to be possible with svmclassify.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 24 Feb. 2014

Kommentiert:

am 24 Feb. 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by