Is it s defect that the fitcsvm() function picked some "far away" points as the support vectors?
2 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.
X = feature;
Y = label;
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]);
svInd = SVMModel.IsSupportVector;
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 : https://www.mathworks.com/help/stats/optimize-an-svm-classifier-fit-using-bayesian-optimization.html
Hope this helps!