How to detection score using Naive Bayes classifier?

1 Ansicht (letzte 30 Tage)
FARHAD
FARHAD am 11 Aug. 2014
Kommentiert: FARHAD am 11 Aug. 2014
Hi, I am new in Naive Bayes classifier. How to get detection score or test score using Naive Bayes classifier in Matlab? Is posterior probability=detection score?

Antworten (1)

Supreeth Subbaraya
Supreeth Subbaraya am 11 Aug. 2014
Once you have the trained model, you can use the function predict to classify your test data into one of the classes. The documentation for predict can be found here.
posterior function gives the posterior probability of the observations in the test data. It gives the probability with which each test points would fall into each of the classes. The documentation for the posterior function can be found here.
If the term "detection score" means the count of the samples in the test data that have been classified properly, you can find an example to obtain the misclassification rate here. In the section "Examples" on the page, go to "Train Naive Bayes Classifiers Using Multinomial Predictors". Here you can see that if you have a trained Naive Bayes Classifier NBModel, you can find out the misclassification rate by the following lines of code:
predSpam = predict(NBModel,X);
misclass = sum(y'~=predSpam)/n
Here X is the predictors and n is the sample size. You can just get the number of samples misclassified by not dividing by n . Once you have the number of samples misclassified, you can find out the numbers of samples classified correctly. You can use this information to evaluate the performance of your trained model.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by