Is it s defect that the fitcsvm() function picked some "far away" points as the support vectors?

3 views (last 30 days)
I used fitcsvm() to run SVM on some data with Gaussian kernel.
The yellow circled points are the support vector.
However, some points at the bottom shouldn't be support vectors, as they are far away from the decision boundary.
Therefore picking them as support vectors is not reasonable.
I wonder if they are mistakenly picked by the algorithm? Is that a defect?
The data.mat file is as attached.
close all;
X = feature;
Y = label;
%% Computation
SVMModel = fitcsvm(X,Y,'ClassNames',[false true],'Standardize',true,...
margin = 1;
x_start=min(X(:,1)) - margin;
x_end=max(X(:,1)) + margin;
y_start=min(X(:,2)) - margin;
y_end=max(X(:,2)) + margin;
d = 0.02;
[x1Grid,x2Grid] = meshgrid(x_start:d:x_end,...
xGrid = [x1Grid(:),x2Grid(:)];
N = size(xGrid,1);
Scores = zeros(N,2);
[~,score] = predict(SVMModel,xGrid);
[~,maxScore] = max(score,[],2);
%% Plot Graph
gscatter(xGrid(:,1),xGrid(:,2),maxScore, [0.5 0.1 0.5; 0.1 0.5 0.5]);
hold on
title('{\bf SVM}');
axis tight
svInd = SVMModel.IsSupportVector;
hold off

Answers (1)

Rajani Mishra
Rajani Mishra on 16 Apr 2020
To understand how well or bad svm classification is performing calculate loss error, you can use loss function for the same. Refer to this link for learning about it.
Also you can try to optimize result of svm classifier. Refer to this link for more information :
Hope this helps!

Community Treasure Hunt

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

Start Hunting!