How to detection score using Naive Bayes classifier?

1 回表示 (過去 30 日間)
FARHAD
FARHAD 2014 年 8 月 11 日
コメント済み: FARHAD 2014 年 8 月 11 日
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?

回答 (1 件)

Supreeth Subbaraya
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.
  1 件のコメント
FARHAD
FARHAD 2014 年 8 月 11 日
Thanks sir. Really it's helpful.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNaive Bayes についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by