In the below code what is meant by grouptrain or what does it include? Also what is the difference between trainingset and grouptrain here?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
function [result] = multisvm(TrainingSet,GroupTrain,TestSet) %Models a given training set with a corresponding group vector and %classifies a given test set using an SVM classifier according to a %one vs. all relation. % %This code was written by Cody Neuburger cneuburg@fau.edu %Florida Atlantic University, Florida USA %This code was adapted and cleaned from Anand Mishra's multisvm function %found at http://www.mathworks.com/matlabcentral/fileexchange/33170-multi-class-support-vector-machine/
u=unique(GroupTrain); numClasses=length(u); result = zeros(length(TestSet(:,1)),1);
%build models for k=1:numClasses %Vectorized statement that binarizes Group %where 1 is the current class and 0 is all other classes G1vAll=(GroupTrain==u(k)); models(k) = svmtrain(TrainingSet,G1vAll); end
%classify test cases for j=1:size(TestSet,1) for k=1:numClasses if(svmclassify(models(k),TestSet(j,:))) break; end end result(j) = k; end
0 comentarios
Respuestas (1)
Pranay Patel
el 29 de Jun. de 2016
As SVM is supervised learning model, GroupTrain includes labels of TrainingSet images while TrainingSet includes features extracted from those images in order. For example 8 images from img1 to img8: TrainingSet=[ 1 10;2 20;3 30;4 40;5 50;6 66;3 30;4.1 42]; GroupTrain=[1;1;2;2;3;3;2;2];
Here, feature extracted from img1 are 1 10 and its class label is 1, same for rest images.
0 comentarios
Ver también
Categorías
Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!