mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skasab2s <skasa...@smail.inf.fh-brs.de>
Subject Nave Bayes Classifier and probability calculation for a single test example
Date Tue, 03 May 2011 15:15:00 GMT
Hello,

I tried out Mahout's Naive Bayes example for "history and science" and it
worked great! I have a question about the classifying part:

  for (Map.Entry&lt;String, List&lt;String&gt;> stringListEntry :
document.entrySet()) {
              List<String> strings = stringListEntry.getValue();
              ClassifierResult classifiedLabel = classifier.classify(model,
                  strings.toArray(new String[strings.size()]),
                  defaultCat);
  ...
boolean correct = resultAnalyzer.addInstance(correctLabel, classifiedLabel);
}

As a result for a single test example (in this case 'document'), we get a
boolean value. I'm a little bit confused, because as far as I know, Naive
Bayes is a probabilistic model
(http://en.wikipedia.org/wiki/Naive_Bayes_classifier) and when classifying a
single instance, it should return a probability (measured in percentage, and
not in true/false). 

So, how can I get a percentage instead of a boolean when using Naive Bayes /
Complementary Bayes?

Many thanks and best regards!

Svetlomir Kasabov   

--
View this message in context: http://lucene.472066.n3.nabble.com/Nave-Bayes-Classifier-and-probability-calculation-for-a-single-test-example-tp2894633p2894633.html
Sent from the Mahout User List mailing list archive at Nabble.com.

Mime
View raw message