org.apache.mahout.df.mapred.partial
Class Step2Mapper

java.lang.Object
  extended by org.apache.hadoop.mapred.MapReduceBase
      extended by org.apache.mahout.df.mapred.partial.Step2Mapper
All Implemented Interfaces:
java.io.Closeable, org.apache.hadoop.mapred.JobConfigurable, org.apache.hadoop.mapred.Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,TreeID,MapredOutput>

public class Step2Mapper
extends org.apache.hadoop.mapred.MapReduceBase
implements org.apache.hadoop.mapred.Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,TreeID,MapredOutput>

Second step of PartialBuilder. Using the trees of the first step, computes the oob predictions for each tree, except those of its own partition, on all instancesof the partition.


Constructor Summary
Step2Mapper()
           
 
Method Summary
 void close()
           
 void configure(int partition, Dataset dataset, TreeID[] keys, Node[] trees, int numInstances)
          Useful for testing.
 void configure(org.apache.hadoop.mapred.JobConf job)
           
 void map(org.apache.hadoop.io.LongWritable key, org.apache.hadoop.io.Text value, org.apache.hadoop.mapred.OutputCollector<TreeID,MapredOutput> output, org.apache.hadoop.mapred.Reporter reporter)
           
static int nbConcerned(int numMaps, int numTrees, int partition)
          Compute the number of trees that need to classify the instances of this mapper's partition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Step2Mapper

public Step2Mapper()
Method Detail

configure

public void configure(org.apache.hadoop.mapred.JobConf job)
Specified by:
configure in interface org.apache.hadoop.mapred.JobConfigurable
Overrides:
configure in class org.apache.hadoop.mapred.MapReduceBase

nbConcerned

public static int nbConcerned(int numMaps,
                              int numTrees,
                              int partition)
Compute the number of trees that need to classify the instances of this mapper's partition

Parameters:
numMaps - total number of map tasks
numTrees - total number of trees in the forest
partition - mapper's partition
Returns:

configure

public void configure(int partition,
                      Dataset dataset,
                      TreeID[] keys,
                      Node[] trees,
                      int numInstances)
Useful for testing. Configures the mapper without using a JobConf
TODO we don't need the keys partitions, the tree ids should suffice

Parameters:
partition - mapper's partition
dataset -
keys - keys returned by the first step
trees - trees returned by the first step
numInstances - number of instances in the mapper's partition

map

public void map(org.apache.hadoop.io.LongWritable key,
                org.apache.hadoop.io.Text value,
                org.apache.hadoop.mapred.OutputCollector<TreeID,MapredOutput> output,
                org.apache.hadoop.mapred.Reporter reporter)
         throws java.io.IOException
Specified by:
map in interface org.apache.hadoop.mapred.Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,TreeID,MapredOutput>
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class org.apache.hadoop.mapred.MapReduceBase
Throws:
java.io.IOException


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.