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 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Pranay Patel
2016년 6월 29일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!