You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by siddharth chhabra <si...@hotmail.com> on 2010/11/08 08:24:16 UTC

NPE while running testclassifier

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 
 		 	   		  

RE: NPE while running testclassifier

Posted by siddharth chhabra <si...@hotmail.com>.
And this is the error I get -
siddharth_chhabra @ ~/Downloads/devfun/mahout/$$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
no HADOOP_HOME set, running locally
Nov 17, 2010 10:55:03 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: Loading model from: {basePath=examples/bin/work/20news-bydate/bayes-model, classifierType=bayes, alpha_i=1.0, dataSource=hdfs, gramSize=1, verbose=false, encoding=UTF-8, defaultCat=unknown, testDirPath=examples/bin/work/20news-bydate/bayes-test-input}
Nov 17, 2010 10:55:03 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: Testing Bayes Classifier
Nov 17, 2010 10:55:03 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: file:/Users/siddharth_chhabra/Downloads/devfun/mahout/examples/bin/work/20news-bydate/bayes-model/trainer-weights/Sigma_j/part-00000
Nov 17, 2010 10:55:04 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: Read 50000 feature weights
Nov 17, 2010 10:55:04 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: Read 100000 feature weights
Nov 17, 2010 10:55:04 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: file:/Users/siddharth_chhabra/Downloads/devfun/mahout/examples/bin/work/20news-bydate/bayes-model/trainer-weights/Sigma_k/part-00000
Nov 17, 2010 10:55:04 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: file:/Users/siddharth_chhabra/Downloads/devfun/mahout/examples/bin/work/20news-bydate/bayes-model/trainer-weights/Sigma_kSigma_j/part-00000
Nov 17, 2010 10:55:04 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: 190570.4012562479
Nov 17, 2010 10:55:04 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: file:/Users/siddharth_chhabra/Downloads/devfun/mahout/examples/bin/work/20news-bydate/bayes-model/trainer-thetaNormalizer/part-00000
Nov 17, 2010 10:55:04 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: file:/Users/siddharth_chhabra/Downloads/devfun/mahout/examples/bin/work/20news-bydate/bayes-model/trainer-tfIdf/trainer-tfIdf/part-00000
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: rec.sport.baseball -127395.14399316616 547567.2698760114 -0.232656608606305
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: sci.crypt -189010.62350617323 547567.2698760114 -0.3451824714595741
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: rec.sport.hockey -166203.2548335905 547567.2698760114 -0.3035302947731423
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: talk.politics.guns -198793.14260997134 547567.2698760114 -0.3630478911841921
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: soc.religion.christian -158106.48187003663 547567.2698760114 -0.2887434851718539
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: sci.electronics -138650.82033374818 547567.2698760114 -0.25321239592195427
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: comp.os.ms-windows.misc -547567.2698760114 547567.2698760114 -1.0
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: misc.forsale -141981.48005545404 547567.2698760114 -0.2592950453148956
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: talk.religion.misc -134885.60852883724 547567.2698760114 -0.2463361416020722
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: alt.atheism -134262.42728922528 547567.2698760114 -0.24519805086163576
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: comp.windows.x -172513.19965389522 547567.2698760114 -0.3150538922696353
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: talk.politics.mideast -189368.63272082788 547567.2698760114 -0.3458362892356726
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: comp.sys.ibm.pc.hardware -134535.56471897085 547567.2698760114 -0.24569687072317975
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: comp.sys.mac.hardware -121323.6282757108 547567.2698760114 -0.22156844455510052
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: sci.space -189203.04544769705 547567.2698760114 -0.3455338838834164
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: rec.motorcycles -138625.2628242977 547567.2698760114 -0.25316572127418674
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: rec.autos -136935.18434679657 547567.2698760114 -0.25007919917821886
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: comp.graphics -161979.38306986375 547567.2698760114 -0.29581640828631267
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: talk.politics.misc -159579.70032298338 547567.2698760114 -0.29143396455949216
Nov 17, 2010 10:55:06 PM org.slf4j.impl.JCLLoggerAdapter info
INFO: sci.med -183835.5334355675 547567.2698760114 -0.3357314133790253
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:69)
    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:182)

> From: siddharthchhabra@hotmail.com
> To: user@mahout.apache.org
> Subject: RE: NPE while running testclassifier
> Date: Thu, 18 Nov 2010 06:24:25 +0000
> 
> 
> I read through the whole archive discussion but he is not getting the same error as me.
> I am still getting the same NPE as before no matter how many how many documents i put in  the bayes-test-input folder.
> Has anybody tested the classifier without hadoop ?
> I am on a mac os with jdk 1.6 and have not set hadoop_home variable, but set mahout_home correctly.
> 
> I am in los angeles and dont mind meeting someone in person to resolve the issue either.
> Any pointers will be appreciated.
> 
> Thanks
> -Sid
> > From: robin.anil@gmail.com
> > Date: Fri, 12 Nov 2010 23:16:48 +0530
> > Subject: Re: NPE while running testclassifier
> > To: user@mahout.apache.org
> > 
> > Read through this archive discussion.
> > 
> > http://mail-archives.apache.org/mod_mbox/mahout-user/201010.mbox/%3CAANLkTikSyB4+pQ2pspMwoz=2r7q=kefg_=+HAvTuVLiE@mail.gmail.com%3E
>  		 	   		  
 		 	   		  

RE: NPE while running testclassifier

Posted by Divya <di...@k2associates.com.sg>.
Hi,
Even I am getting the same error as Siddharth for Testclassifier.

I have followed the steps given in
https://cwiki.apache.org/MAHOUT/wikipedia-bayes-example.html
I am ruuning Mahout-0.4 on windows m/c using JDK 1.6.

$bin/mahout testclassifier -m
D:/mahout-0.4/examples/bin/work/wikipedia/wikipediaClassification/wikipediao
utput -d D:/mahout-0.4/examp
les/bin/work/wikipedia/wikipediaClassification/wikipediainput
Running on hadoop, using HADOOP_HOME=C:\cygwin\home\Divya\hadoop-0.20.2
HADOOP_CONF_DIR=C:\cygwin\home\Divya\hadoop-0.20.2\conf
10/11/19 09:14:44 INFO bayes.TestClassifier: Loading model from:
{basePath=D/mahout-0.4/examples/bin/work/wikipedia/wikipediaClassifica
tion/wikipediaoutput, classifierType=bayes, alpha_i=1.0, dataSource=hdfs,
gramSize=1, verbose=false, encoding=UTF-8, defaultCat=unknown
,
testDirPath=D:/mahout-0.4/examples/bin/work/wikipedia/wikipediaClassificatio
n/wikipediainput}
10/11/19 09:14:44 INFO bayes.TestClassifier: Testing Bayes Classifier
Exception in thread "main" java.lang.NullPointerException
        at
org.apache.mahout.classifier.ConfusionMatrix.getCount(ConfusionMatrix.java:1
02)
        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.jav
a:90)
        at
org.apache.mahout.classifier.ResultAnalyzer.addInstance(ResultAnalyzer.java:
68)
        at
org.apache.mahout.classifier.bayes.TestClassifier.classifySequential(TestCla
ssifier.java:266)
        at
org.apache.mahout.classifier.bayes.TestClassifier.main(TestClassifier.java:1
86)
        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)
        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.RunJar.main(RunJar.java:156)


@Siddharth  - Are you able to resolve your error.
I have observed that in  wikipediamodel it places file inside
trainer-tfIdf\trainer-tfIdf
Can any one point me why nested folders for trainer-tfIdf.


Thanks
Regards,
Divya

-----Original Message-----
From: siddharth chhabra [mailto:siddharthchhabra@hotmail.com] 
Sent: Thursday, November 18, 2010 2:24 PM
To: user@mahout.apache.org
Subject: RE: NPE while running testclassifier


I read through the whole archive discussion but he is not getting the same
error as me.
I am still getting the same NPE as before no matter how many how many
documents i put in  the bayes-test-input folder.
Has anybody tested the classifier without hadoop ?
I am on a mac os with jdk 1.6 and have not set hadoop_home variable, but set
mahout_home correctly.

I am in los angeles and dont mind meeting someone in person to resolve the
issue either.
Any pointers will be appreciated.

Thanks
-Sid
> From: robin.anil@gmail.com
> Date: Fri, 12 Nov 2010 23:16:48 +0530
> Subject: Re: NPE while running testclassifier
> To: user@mahout.apache.org
> 
> Read through this archive discussion.
> 
>
http://mail-archives.apache.org/mod_mbox/mahout-user/201010.mbox/%3CAANLkTik
SyB4+pQ2pspMwoz=2r7q=kefg_=+HAvTuVLiE@mail.gmail.com%3E
 		 	   		  


RE: NPE while running testclassifier

Posted by siddharth chhabra <si...@hotmail.com>.
I read through the whole archive discussion but he is not getting the same error as me.
I am still getting the same NPE as before no matter how many how many documents i put in  the bayes-test-input folder.
Has anybody tested the classifier without hadoop ?
I am on a mac os with jdk 1.6 and have not set hadoop_home variable, but set mahout_home correctly.

I am in los angeles and dont mind meeting someone in person to resolve the issue either.
Any pointers will be appreciated.

Thanks
-Sid
> From: robin.anil@gmail.com
> Date: Fri, 12 Nov 2010 23:16:48 +0530
> Subject: Re: NPE while running testclassifier
> To: user@mahout.apache.org
> 
> Read through this archive discussion.
> 
> http://mail-archives.apache.org/mod_mbox/mahout-user/201010.mbox/%3CAANLkTikSyB4+pQ2pspMwoz=2r7q=kefg_=+HAvTuVLiE@mail.gmail.com%3E
 		 	   		  

Re: NPE while running testclassifier

Posted by Robin Anil <ro...@gmail.com>.
Read through this archive discussion.

http://mail-archives.apache.org/mod_mbox/mahout-user/201010.mbox/%3CAANLkTikSyB4+pQ2pspMwoz=2r7q=kefg_=+HAvTuVLiE@mail.gmail.com%3E

Re: NPE while running testclassifier

Posted by Xiaomeng Wan <sh...@gmail.com>.
one document is not enough to make the ConfusionMatrix, try to put all
of your documents there and see whether that works.

Regards,
Xiaomeng Wan

On Wed, Nov 10, 2010 at 7:20 PM, siddharth chhabra
<si...@hotmail.com> wrote:
>
> Can somebody point me in the right direction ?
> Any help would be greatly appreciated.
>
> Thanks
> -Sid
>> From: siddharthchhabra@hotmail.com
>> To: user@mahout.apache.org
>> Subject: RE: NPE while running testclassifier
>> Date: Mon, 8 Nov 2010 18:09:11 +0000
>>
>>
>> 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: robin.anil@gmail.com
>> > Date: Mon, 8 Nov 2010 15:57:00 +0530
>> > Subject: Re: NPE while running testclassifier
>> > To: user@mahout.apache.org
>> >
>> > Please give full details of what you did. Command line wise
>> >
>> > On Mon, Nov 8, 2010 at 12:54 PM, siddharth chhabra <
>> > siddharthchhabra@hotmail.com> 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
>> > >
>>
>

RE: NPE while running testclassifier

Posted by siddharth chhabra <si...@hotmail.com>.
Can somebody point me in the right direction ?
Any help would be greatly appreciated.

Thanks
-Sid
> From: siddharthchhabra@hotmail.com
> To: user@mahout.apache.org
> Subject: RE: NPE while running testclassifier
> Date: Mon, 8 Nov 2010 18:09:11 +0000
> 
> 
> 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: robin.anil@gmail.com
> > Date: Mon, 8 Nov 2010 15:57:00 +0530
> > Subject: Re: NPE while running testclassifier
> > To: user@mahout.apache.org
> > 
> > Please give full details of what you did. Command line wise
> > 
> > On Mon, Nov 8, 2010 at 12:54 PM, siddharth chhabra <
> > siddharthchhabra@hotmail.com> 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
> > >
>  		 	   		  
 		 	   		  

RE: NPE while running testclassifier

Posted by siddharth chhabra <si...@hotmail.com>.
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: robin.anil@gmail.com
> Date: Mon, 8 Nov 2010 15:57:00 +0530
> Subject: Re: NPE while running testclassifier
> To: user@mahout.apache.org
> 
> Please give full details of what you did. Command line wise
> 
> On Mon, Nov 8, 2010 at 12:54 PM, siddharth chhabra <
> siddharthchhabra@hotmail.com> 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
> >
 		 	   		  

Re: NPE while running testclassifier

Posted by Robin Anil <ro...@gmail.com>.
Please give full details of what you did. Command line wise

On Mon, Nov 8, 2010 at 12:54 PM, siddharth chhabra <
siddharthchhabra@hotmail.com> 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
>