You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Walter Chang <we...@gmail.com> on 2011/09/06 03:56:46 UTC
bug when generating sparse vector
Hi
./bin/mahout seq2sparse -i ../../socialtvdata/socialtv-seqfiles -o
../../socialtvdata/socialtv-vectors -a
org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer
I'm using Lucene's Chinese Analyzer to calculate the tokens(tf-idf scores)
for clustering purposes. It seems it has running issue (see following) . i'm
using the contributed pkg of lucene 3.3. I haven't spent time looking into
details. If any one see this before and fixed it, that will be great help to
me. Thanks a lot,
Weide
Exception in thread "main" java.lang.InstantiationException:
org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer
at java.lang.Class.newInstance0(Class.java:340)
at java.lang.Class.newInstance(Class.java:308)
at
org.apache.mahout.vectorizer.SparseVectorsFromSequenceFiles.run(SparseVectorsFromSequenceFiles.java:198)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79)
at
org.apache.mahout.vectorizer.SparseVectorsFromSequenceFiles.main(SparseVectorsFromSequenceFiles.java:52)
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:188)
Re: bug when generating sparse vector
Posted by Robin Anil <ro...@gmail.com>.
Yes. See the default values for minSupport using --help on seq2sparse
command
On Tue, Sep 6, 2011 at 12:47 PM, Walter Chang <we...@gmail.com>wrote:
> works. After dumping the content, it seems the tokenized
> document seems to be correct. However, the word count doesn't contain
> the
> term that has only 1 occurence (same content shows for the dictionary file
> as well). Is that expected behavior ?
>
Re: bug when generating sparse vector
Posted by Walter Chang <we...@gmail.com>.
Thanks Robin. It works. After dumping the content, it seems the tokenized
document seems to be correct. However, the word count doesn't contain the
term that has only 1 occurence (same content shows for the dictionary file
as well). Is that expected behavior ?
Thanks ,
Weide
On Mon, Sep 5, 2011 at 10:51 PM, Robin Anil <ro...@gmail.com> wrote:
> use the sequence file dumper to inspect the files
>
> bin/mahout seqdumper --help
>
> On Tue, Sep 6, 2011 at 10:03 AM, Walter Chang <weidezhang2007@gmail.com
> >wrote:
>
> > i ended up add a default SmartChineseAnalyzer constructor to get around
> > with
> > the issue. I have another question. Right now, I can see the following
> > directories created but it seems to be they are encoded using some binary
> > format. Is there any tool to double check the generated contents as well
> as
> > TF-IDF score calculated ?
> >
> > df-count dictionary.file-0 frequency.file-0 tfidf-vectors tf-vectors
> > tokenized-documents wordcount
> >
> > Thanks a lot,
> >
> > Weide
> >
> > On Mon, Sep 5, 2011 at 9:03 PM, Jake Mannix <ja...@gmail.com>
> wrote:
> >
> > > On Mon, Sep 5, 2011 at 8:36 PM, Lance Norskog <go...@gmail.com>
> wrote:
> > > >
> > > >
> > > > A Lucene expert could change SparseVectors to handle this case.
> (There
> > > > might
> > > > be other problems.)
> > > >
> > >
> > > I don't think we need a Lucene expert, we just need to change the logic
> > of
> > > "instantiate
> > > Analyzer via no-arg constructor" to "if no-arg constructor exist for
> the
> > > Analyzer, use it,
> > > else try the single-arg constructor which takes a LuceneUtil.VERSION as
> > the
> > > argument".
> > > And possibly let the client specify the lucene version (making sure to
> > swap
> > > out all the
> > > lucene jars which might be needed of that exact version) on the command
> > > line.
> > >
> > > -jake
> > >
> >
>
Re: bug when generating sparse vector
Posted by Robin Anil <ro...@gmail.com>.
use the sequence file dumper to inspect the files
bin/mahout seqdumper --help
On Tue, Sep 6, 2011 at 10:03 AM, Walter Chang <we...@gmail.com>wrote:
> i ended up add a default SmartChineseAnalyzer constructor to get around
> with
> the issue. I have another question. Right now, I can see the following
> directories created but it seems to be they are encoded using some binary
> format. Is there any tool to double check the generated contents as well as
> TF-IDF score calculated ?
>
> df-count dictionary.file-0 frequency.file-0 tfidf-vectors tf-vectors
> tokenized-documents wordcount
>
> Thanks a lot,
>
> Weide
>
> On Mon, Sep 5, 2011 at 9:03 PM, Jake Mannix <ja...@gmail.com> wrote:
>
> > On Mon, Sep 5, 2011 at 8:36 PM, Lance Norskog <go...@gmail.com> wrote:
> > >
> > >
> > > A Lucene expert could change SparseVectors to handle this case. (There
> > > might
> > > be other problems.)
> > >
> >
> > I don't think we need a Lucene expert, we just need to change the logic
> of
> > "instantiate
> > Analyzer via no-arg constructor" to "if no-arg constructor exist for the
> > Analyzer, use it,
> > else try the single-arg constructor which takes a LuceneUtil.VERSION as
> the
> > argument".
> > And possibly let the client specify the lucene version (making sure to
> swap
> > out all the
> > lucene jars which might be needed of that exact version) on the command
> > line.
> >
> > -jake
> >
>
Re: bug when generating sparse vector
Posted by Walter Chang <we...@gmail.com>.
i ended up add a default SmartChineseAnalyzer constructor to get around with
the issue. I have another question. Right now, I can see the following
directories created but it seems to be they are encoded using some binary
format. Is there any tool to double check the generated contents as well as
TF-IDF score calculated ?
df-count dictionary.file-0 frequency.file-0 tfidf-vectors tf-vectors
tokenized-documents wordcount
Thanks a lot,
Weide
On Mon, Sep 5, 2011 at 9:03 PM, Jake Mannix <ja...@gmail.com> wrote:
> On Mon, Sep 5, 2011 at 8:36 PM, Lance Norskog <go...@gmail.com> wrote:
> >
> >
> > A Lucene expert could change SparseVectors to handle this case. (There
> > might
> > be other problems.)
> >
>
> I don't think we need a Lucene expert, we just need to change the logic of
> "instantiate
> Analyzer via no-arg constructor" to "if no-arg constructor exist for the
> Analyzer, use it,
> else try the single-arg constructor which takes a LuceneUtil.VERSION as the
> argument".
> And possibly let the client specify the lucene version (making sure to swap
> out all the
> lucene jars which might be needed of that exact version) on the command
> line.
>
> -jake
>
Re: bug when generating sparse vector
Posted by Jake Mannix <ja...@gmail.com>.
On Mon, Sep 5, 2011 at 8:36 PM, Lance Norskog <go...@gmail.com> wrote:
>
>
> A Lucene expert could change SparseVectors to handle this case. (There
> might
> be other problems.)
>
I don't think we need a Lucene expert, we just need to change the logic of
"instantiate
Analyzer via no-arg constructor" to "if no-arg constructor exist for the
Analyzer, use it,
else try the single-arg constructor which takes a LuceneUtil.VERSION as the
argument".
And possibly let the client specify the lucene version (making sure to swap
out all the
lucene jars which might be needed of that exact version) on the command
line.
-jake
Re: bug when generating sparse vector
Posted by Lance Norskog <go...@gmail.com>.
"InstantiationException" probably means that it cannot create an object from
this class. I've had some problems that caused this:
1) the class depends on other classes which are not in the classpath.
2) there is no zero-arg constructor.
3) it was not a public class.
There should be some more error messages. At the bottom of SparseVectors...
the catch block prints the stack you see. You might try logging
'e.getCause()' and e.getMessage().
And now, from looking at the code: you are trying to use the Lucene trunk.
The SparseVectorsFromSequanceFiles (SVFSF) code needs a fix to support the
trunk.
SVFSF tries to make a new instance of the class from a no-arg constructor,
which the class does not have. The nearest equivalent is a constructor that
includes a Lucene index version number. Almost all of the Analyzer classes
have the same problem. In other words, it is impossible to use the Lucene
trunk with SVFSF.
A Lucene expert could change SparseVectors to handle this case. (There might
be other problems.)
Please file a JIRA to upgrade (or support) the Lucene trunk.
Lance
On Mon, Sep 5, 2011 at 6:56 PM, Walter Chang <we...@gmail.com>wrote:
> Hi
>
> ./bin/mahout seq2sparse -i ../../socialtvdata/socialtv-seqfiles -o
> ../../socialtvdata/socialtv-vectors -a
> org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer
>
> I'm using Lucene's Chinese Analyzer to calculate the tokens(tf-idf scores)
> for clustering purposes. It seems it has running issue (see following) .
> i'm
> using the contributed pkg of lucene 3.3. I haven't spent time looking into
> details. If any one see this before and fixed it, that will be great help
> to
> me. Thanks a lot,
>
> Weide
>
> Exception in thread "main" java.lang.InstantiationException:
> org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer
> at java.lang.Class.newInstance0(Class.java:340)
> at java.lang.Class.newInstance(Class.java:308)
> at
>
> org.apache.mahout.vectorizer.SparseVectorsFromSequenceFiles.run(SparseVectorsFromSequenceFiles.java:198)
> at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
> at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79)
> at
>
> org.apache.mahout.vectorizer.SparseVectorsFromSequenceFiles.main(SparseVectorsFromSequenceFiles.java:52)
> 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:188)
>
--
Lance Norskog
goksron@gmail.com