public class WekaClassifierHadoopMapper
extends org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,org.apache.hadoop.io.Text,org.apache.hadoop.io.BytesWritable>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASSIFIER_MAP_TASK_OPTIONS
The key in the Configuration that the options for this task are associated
with
|
Constructor and Description |
---|
WekaClassifierHadoopMapper() |
Modifier and Type | Method and Description |
---|---|
void |
cleanup(org.apache.hadoop.mapreduce.Mapper.Context context) |
void |
map(org.apache.hadoop.io.LongWritable key,
org.apache.hadoop.io.Text value,
org.apache.hadoop.mapreduce.Mapper.Context context) |
static void |
setClassIndex(java.lang.String[] options,
Instances data,
boolean defaultToLast)
Helper method to set the class index in a supplied Instances object
|
static void |
setClassIndex(java.lang.String classNameOrIndex,
Instances data,
boolean defaultToLast)
Helper method for setting the class index in the supplied Instances object
|
void |
setup(org.apache.hadoop.mapreduce.Mapper.Context context) |
public static final java.lang.String CLASSIFIER_MAP_TASK_OPTIONS
public static void setClassIndex(java.lang.String classNameOrIndex, Instances data, boolean defaultToLast) throws java.lang.Exception
classNameOrIndex
- name or index of the class attribute (may be the
special 'first' or 'last' strings)data
- the data to set the class index indefaultToLast
- true if the data should have the last attribute set to
the class if no class name/index is suppliedjava.lang.Exception
- if a problem occurspublic static void setClassIndex(java.lang.String[] options, Instances data, boolean defaultToLast) throws java.lang.Exception
options
- an options string that potentially contains the -class
option for specifying the index/name of the class attributedata
- the Instances to set the class index fordefaultToLast
- true to set the last attribute as the class if no
-class option is present in the optionsjava.lang.Exception
- if a problem occurspublic void setup(org.apache.hadoop.mapreduce.Mapper.Context context) throws java.io.IOException
setup
in class org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,org.apache.hadoop.io.Text,org.apache.hadoop.io.BytesWritable>
java.io.IOException
public void map(org.apache.hadoop.io.LongWritable key, org.apache.hadoop.io.Text value, org.apache.hadoop.mapreduce.Mapper.Context context) throws java.io.IOException
map
in class org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,org.apache.hadoop.io.Text,org.apache.hadoop.io.BytesWritable>
java.io.IOException
public void cleanup(org.apache.hadoop.mapreduce.Mapper.Context context) throws java.io.IOException, java.lang.InterruptedException
cleanup
in class org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,org.apache.hadoop.io.Text,org.apache.hadoop.io.BytesWritable>
java.io.IOException
java.lang.InterruptedException