-
Notifications
You must be signed in to change notification settings - Fork 1
/
Classification_SVMPoly.m
34 lines (22 loc) · 1.12 KB
/
Classification_SVMPoly.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
% Function to Classify data points using SVM-Polynomial kernel classifier
function [Error,Predicted_Labels]=Classification_SVMPoly(Projected_Images_Training,Train_Labels,Projected_Images_Testing,Ground_Labels)
%Input
%
% Projected_Images_Training : Matrix containing projected training Images
% Projected_Images_Testing : Matrix containing projected testing Images
% Train_Labels : Training Labesl of Images
% Ground_Labels : Ground Truth for each testing Image
%
% Output
% Error : Error of classification using svm-poly
%
%
% Author : Sunny Verma ([email protected])
% Last_Update : 28/08/2016
%
Testing_Images=size(Projected_Images_Testing,1);
t=templateSVM('KernelFunction','polynomial','PolynomialOrder',3,'Standardize',1);
svm_mdl=fitcecoc(Projected_Images_Training,Train_Labels,'Coding','onevsall','Learners',t,'Options',statset('UseParallel',1));
Predicted_Labels=predict(svm_mdl,Projected_Images_Testing);
Error=nnz(Predicted_Labels-Ground_Labels)/Testing_Images;
end