How to detection score using Naive Bayes classifier?
조회 수: 1 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (1개)
Supreeth Subbaraya
2014년 8월 11일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Naive Bayes에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!