mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skasab2s <>
Subject Nave Bayes Classifier and probability calculation for a single test example
Date Tue, 03 May 2011 15:15:00 GMT

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()]),
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
( 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:
Sent from the Mahout User List mailing list archive at

View raw message