Hi
I ran the following commands after setting the MAHOUT_HOME and running mvn 
install in the base folder - 
$MAHOUT_HOME/bin/mahout 
org.apache.mahout.classifier.bayes.PrepareTwentyNewsgroups \
  -p examples/bin/work/20news-bydate/20news-bydate-train \
  -o examples/bin/work/20news-bydate/bayes-train-input \
  -a org.apache.mahout.vectorizer.DefaultAnalyzer \
  -c UTF-8

$MAHOUT_HOME/bin/mahout trainclassifier \
  -i examples/bin/work/20news-bydate/bayes-train-input \
  -o examples/bin/work/20news-bydate/bayes-model \
  -type bayes \
  -ng 1 \
  -source hdfs

$MAHOUT_HOME/bin/mahout testclassifier \
  -m examples/bin/work/20news-bydate/bayes-model \
  -d examples/bin/work/20news-bydate/bayes-test-input \
  -type bayes \
  -ng 1 \
  -source hdfs \
  -method sequential

I created the bayes-test-input folder before running the last command 
(testclassifier) and dropped a document in there for classification. 
-Sid
> From: [email protected]
> Date: Mon, 8 Nov 2010 15:57:00 +0530
> Subject: Re: NPE while running testclassifier
> To: [email protected]
> 
> Please give full details of what you did. Command line wise
> 
> On Mon, Nov 8, 2010 at 12:54 PM, siddharth chhabra <
> [email protected]> wrote:
> 
> >
> > Hi
> > I am new to mahout and am using the trunk which I was able to successfully
> > build with maven.
> > I tried to run the newsgroup example and was able to train the classifier
> > successfully.
> > But while running the testclassifier I got a NPE as follows -
> >
> > Exception in thread "main" java.lang.NullPointerException
> >    at
> > org.apache.mahout.classifier.ConfusionMatrix.getCount(ConfusionMatrix.java:102)
> >    at
> > org.apache.mahout.classifier.ConfusionMatrix.incrementCount(ConfusionMatrix.java:118)
> >    at
> > org.apache.mahout.classifier.ConfusionMatrix.incrementCount(ConfusionMatrix.java:122)
> >    at
> > org.apache.mahout.classifier.ConfusionMatrix.addInstance(ConfusionMatrix.java:90)
> >    at
> > org.apache.mahout.classifier.ResultAnalyzer.addInstance(ResultAnalyzer.java:68)
> >    at
> > org.apache.mahout.classifier.bayes.TestClassifier.classifySequential(TestClassifier.java:266)
> >    at
> > org.apache.mahout.classifier.bayes.TestClassifier.main(TestClassifier.java:186)
> >    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >    at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >    at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >    at java.lang.reflect.Method.invoke(Method.java:597)
> >    at
> > org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:68)
> >    at org.apache.hadoop.util.ProgramDriver.driver(ProgramDriver.java:139)
> >    at org.apache.mahout.driver.MahoutDriver.main(MahoutDriver.java:184)
> >
> > I am running this locally without hadoop.
> > I tried following the instructions here -
> > https://cwiki.apache.org/confluence/display/MAHOUT/Twenty+Newsgroups
> > I created the folder bayes-test-input and dropped in a document there for
> > testing purposes but that didnt seem to work.
> >
> > Any pointers will be appreciated.
> >
> > Thanks
> > -Sid
> >
                                          

Reply via email to