forked from Xiaoyang-Rebecca/PatternRecognition_Matlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Classification.m
19 lines (19 loc) · 1010 Bytes
/
Classification.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function Y_Test=Classification(X_Train_Proj, Y_Train, X_Test_Proj,Classifier,K)
if strcmp(Classifier,'GaussianML' )==1
[Y_Test] = GaussianMLClassifier3(X_Train_Proj', Y_Train, X_Test_Proj');
elseif strcmp(Classifier,'KNN' )==1
[Y_Test] = KNNClassifier(X_Train_Proj, Y_Train, X_Test_Proj,K);
elseif strcmp(Classifier,'SVM' )==1
t = templateSVM('Standardize',1,'linear');
Mdl = fitcecoc(X_Train_Proj,Y_Train,...
'Learners',t,'Coding','onevsall');
Y_Test=predict(Mdl,X_Test_Proj);
elseif strcmp(Classifier,'KSVM' )==1
t = templateSVM('Standardize',1,'KernelFunction','rbf');
Mdl = fitcecoc(X_Train_Proj,Y_Train,...
'Learners',t,'Coding','onevsall');
Y_Test=predict(Mdl,X_Test_Proj);
elseif strcmp(Classifier,'GMM' )==1
Y_Test = GMMClassifier( X_Train_Proj, Y_Train,X_Test_Proj,K);
end
end