svmcTrain
Training SVM (support vector machine) classifier
Contents
Syntax
- cPrm=svmcTrain(DS)
- cPrm=svmcTrain(DS, opt)
- [cPrm, ~, recogRate, hitIndex]=svmcTrain(DS, ...)
Description
cPrm=svmcTrain(DS) returns the parameters of SVM (support vector machine) based on the given dataset DS.
opt=svmcTrain('defaultOpt') returns the default options for SVM. You can modify the options if necessary, and send the options for training a SVM:
cPrm=svmcTrain(DS, opt)
Note that this function calls the mex files of libsvm which are available at "http://www.csie.ntu.edu.tw/~cjlin/libsvm/".
Example
DS=prData('iris'); 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); [cPrm, logLike1, recogRate1]=svmcTrain(trainSet); [computedClass, logLike2, recogRate2, hitIndex]=svmcEval(testSet, cPrm); fprintf('Inside recog. rate = %g%%\n', recogRate1*100); fprintf('Outside recog. rate = %g%%\n', recogRate2*100);
Inside recog. rate = 100% Outside recog. rate = 90.6667%