nbcTrain

Training the naive Bayes classifier (NBC)

Contents

Syntax

Description

[cPrm, logLike, recogRate, hitIndex]=nbcTrain(DS, opt, showPlot) returns the training results of the naive bayes classifier

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);
[cPrm, logLike1, recogRate1]=nbcTrain(trainSet);
[computedClass, logLike2, recogRate2, hitIndex]=nbcEval(testSet, cPrm, 1);
fprintf('Inside recog rate = %g%%\n', recogRate1*100);
fprintf('Outside recog rate = %g%%\n', recogRate2*100);
Inside recog rate = 97.3333%
Outside recog rate = 96%

See Also

nbcEval, nbcPlot.


Top page   Next: nbcPlot.m   Prev:objDetect.m