svmcEval2

Evaluation of SVM (support vector machine) classifier

Contents

Syntax

Description

computedClass=svmcEval(DS, svmModel) returns values of SVM (support vector machine) based on the given dataset DS and the SVM model svmModel.

Note that this function calls the mex files of libsvm directly. If the mex file libsvmpredict.mex* under [mltRoot, '/private'] is not found, you need to obtain it from libsvm website at "http://www.csie.ntu.edu.tw/~cjlin/libsvm/".

Example

DS=prData('iris');
DS.input=DS.input(3:4, :);
trainSet.input=DS.input(:, 1:2:end); trainSet.output=DS.output(:, 1:2:end);
testSet.input=DS.input(:, 2:2:end);  testSet.output=DS.output(:, 2:2:end);
[svmPrm, logLike1, recogRate1]=svmcTrain(trainSet);
[computedClass, logLike2, recogRate2, hitIndex]=svmcEval(testSet, svmPrm);
fprintf('Inside recog. rate = %g%%\n', recogRate1*100);
fprintf('Outside recog. rate = %g%%\n', recogRate2*100);
Error: can't read model: number of return field is not correct
Error using ==
Matrix dimensions must agree.

Error in classifierEval (line 215)
	hitIndex=find(computedClass==DS.output);

Error in classifierTrain (line 174)
		[computedClass, logLike, recogRate, hitIndex]=classifierEval(classifier, DS, cPrm);

Error in svmcTrain (line 38)
[cPrm, logLike, recogRate, hitIndex]=classifierTrain(classifier, DS, opt, showPlot);

Error in svmcEval2_help (line 19)
[svmPrm, logLike1, recogRate1]=svmcTrain(trainSet);

See Also

svmTrain.


Top page   Next: svmcEval.m   Prev:svmcTrain.m