Very good! Can you file a hira and attach the patch there?
Am 30.12.2013 08:23 schrieb "Gouri Sankar Majumder" <[email protected]
>:
> Dear All,
>
> I would like to share an issue that I faced with Complementary Naive Bayes
> classifier while developing a text classification system using Mahout. I
> was trying to compare result of Standard Naive Bayes classifier with
> Complementary Naive Bayes classifier. But strangely I was getting same
> accuracy for both classifier. I tried with several datasets but no success.
>
>
> So I looked into the source code of two driver classes
> *org.apache.mahout.classifier.naivebayes.training.TrainNaiveBayesJob.java*and
> *org.apache.mahout.classifier.naivebayes.test.TestNaiveBayesDriver.java*.
> I found following two lines for which always Standard Naive Bayes
> classifier was getting called. "-c" option to run Complementary Naive Bayes
> classifier was not making any change.
>
> *TrainNaiveBayesJob.java : line 96*
> boolean trainComplementary = Boolean.parseBoolean(
> getOption(TRAIN_COMPLEMENTARY));
> // results to false as getOption(TRAIN_COMPLEMENTARY) always returns
> null.
>
> *TestNaiveBayesDriver.java : line 139*
> boolean complementary = parsedArgs.containsKey("testComplementary");
> // always results to false as key in Map parsedArgs is
> "--testComplementary" not "testComplementary".
>
> Due to this Complementary Naive Bayes classifier was never getting called.
>
> So I made following changes and that worked !!!
>
> *TrainNaiveBayesJob.java :*
> boolean trainComplementary = hasOption(TRAIN_COMPLEMENTARY);
>
> *TestNaiveBayesDriver.java :*
> boolean complementary = hasOption("testComplementary"); //or
> complementary = parsedArgs.containsKey("--testComplementary");
>
> Please find attached patch.
>
> With Regards,
> Gouri Sankar Majumder
>