Support Vectors are wrong in my SVR model
1 view (last 30 days)
Show older comments
I trained an SVR model by fitrsvm. Since I need to get all support vector I have checked the model ouput. Surprisingly, the mdl.SupportVectors have nothing in common with my input mdl.X. Can anyone tell me why.
Below is my code. sorry the csv files are too larged to be uploaded.
input = csvread('sample.csv');
target = csvread('target.csv');
Y = log(target(2,:)+1)';
%Y = log(target(2,:)+1)';
%turbidity = log(target(1,:)+1);
turbidity = target(1,:);
mainComp = 15;
s = load('eigenVector.mat','s');
s = s.s;
v = load('singularValue.mat','v');
v = v.v;
a = s'*input;
b = inv(v(1:mainComp,1:mainComp))*a(1:mainComp,:);
X = [b;log(turbidity+1)];
mdl = fitrsvm(X',Y,'Standardize',true,'KernelFunction','polynomial','KernelScale','auto','OutlierFraction',0.05);
save mySVMMDL mdl;
yfit = exp(predict(mdl,X'))-1;
0 Comments
Answers (1)
Jo
on 26 Oct 2023
Hello,
I know this post is old but maybe my answer can help someone that may have the same question ?
The data stored in "mdl.SupportVectors" are preprocessed data. As you have set the option 'standardized','true', these data are standardized. So you need to standardized manually "Mdl.X" to be able to compare both matrices.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!