You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by "Karl Wettin (JIRA)" <ji...@apache.org> on 2008/06/26 17:11:45 UTC
[jira] Issue Comment Edited: (MAHOUT-61) Text problem matrix
builder
[ https://issues.apache.org/jira/browse/MAHOUT-61?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12608463#action_12608463 ]
karl.wettin edited comment on MAHOUT-61 at 6/26/08 8:10 AM:
------------------------------------------------------------
I've started M/R:ing this now. More or less WordCount++, but I don't think my implementation is that nice.
This is what it is:
{code:java}
/** Parses and tokenizes an instance, maps to token weights but also stores a MapWritable<Text, Double> on fs */
class TokenizationMapper implements
Mapper</** instance identity */LongWritable, /** instance path */Path, /** weight */Text, /** weight */ DoubleWritable>
/** Reduces the sum of all weights per token */
class TokenizationReducer implements
Reducer</** token */Text, /** weight */DoubleWritable, /** token */Text, /** weight */DoubleWritable> {
/** Sets up instance parser and tokenizer,
runs TokenizationMapper/TokenizationReducer
creates a MapWritable<Text, IntWritable> with column index, sorted by token frequency
and then runs VectorBuilderMapper (no reducer) to produce the final results. */
class TokenMatrixBuilderDriver {
/** Reads the MapWritable<Text, DoubleWritable> created by TokenizationMapper
and maps the values to a Vector using the MapWritable<Text, IntWritable> produced by TokenMatrixBuilderDriver */
class VectorBuilderMapper implements
Mapper</** instance identity */LongWritable, /** instance path */Path, /** instance identity */LongWritable, Vector> {
{code}
Is there a better way to do this? I'm in particular not enjoying how I store the token vector MapWritable in TokenizationMapper and open it up in the VectorBuilderMapper.
I never really use the "instance identity"-key.
I think the tokenization reducer should count number of instances a feature is used by rather than summing up the weight. Or perhaps a setting to control it. The thought is that it could be used as an initial crude feature selection scheme.
was (Author: karl.wettin):
I've started M/R:ing this now. More or less WordCount++, but I don't think my implementation is that nice.
This is what it is:
{code:java}
/** Parses and tokenizes an instance, maps to token weights but also stores a MapWritable<Text, Double> on fs */
class TokenizationMapper implements
Mapper</** instance identity */LongWritable, /** instance path */Path, /** weight */Text, /** weight */ DoubleWritable>
/** Reduces the sum of all weights per token */
class TokenizationReducer implements
Reducer</** token */Text, /** weight */DoubleWritable, /** token */Text, /** weight */DoubleWritable> {
/** Sets up instance parser and tokenizer,
runs TokenizationMapper/TokenizationReducer
creates a MapWritable<Text, Integer> with column index, sorted by token frequency
and then runs VectorBuilderMapper (no reducer) to produce the final results. */
class TokenMatrixBuilderDriver {
/** Reads the MapWritable<Text, Double> created by TokenizationMapper
and maps the values to a Vector using
class VectorBuilderMapper implements
Mapper</** instance identity */LongWritable, /** instance path */Path, /** instance identity */LongWritable, Vector> {
{code}
Is there a better way to do this? I'm in particular not enjoying how I store the token vector MapWritable in TokenizationMapper and open it up in the VectorBuilderMapper.
I never really use the "instance identity"-key.
I think the tokenization reducer should count number of instances a feature is used by rather than summing up the weight. Or perhaps a setting to control it. The thought is that it could be used as an initial crude feature selection scheme.
> Text problem matrix builder
> ----------------------------
>
> Key: MAHOUT-61
> URL: https://issues.apache.org/jira/browse/MAHOUT-61
> Project: Mahout
> Issue Type: New Feature
> Reporter: Karl Wettin
> Assignee: Karl Wettin
> Priority: Minor
> Attachments: MAHOUT-61.txt
>
>
> A set of classes that builds matrices from text.
> Currently the API consists of TokenMatrixBuilder and TokenInstanceBuilder. Should be thread safe.
> PostReader imports 20news-bydate. This takes several GB heap. It would be nice to bounce the data via JDBM or perhaps using the PersistentHashMap in MAHOUT-19.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.