public final class ToUserVectorsReducer extends org.apache.hadoop.mapreduce.Reducer<VarLongWritable,VarLongWritable,VarLongWritable,VectorWritable>
Takes user IDs as VarLongWritable
mapped to all associated item IDs and preference values, as
EntityPrefWritable
s.
The same user ID mapped to a RandomAccessSparseVector
representation of the same item IDs and
preference values. Item IDs are used as vector indexes; they are hashed into ints to work as indexes with
TasteHadoopUtils.idToIndex(long)
. The mapping is remembered for later with a combination of
ItemIDIndexMapper
and ItemIDIndexReducer
.
Modifier and Type | Class and Description |
---|---|
static class |
ToUserVectorsReducer.Counters |
Modifier and Type | Field and Description |
---|---|
static String |
MIN_PREFERENCES_PER_USER |
Constructor and Description |
---|
ToUserVectorsReducer() |
Modifier and Type | Method and Description |
---|---|
protected void |
reduce(VarLongWritable userID,
Iterable<VarLongWritable> itemPrefs,
org.apache.hadoop.mapreduce.Reducer.Context context) |
protected void |
setup(org.apache.hadoop.mapreduce.Reducer.Context ctx) |
public static final String MIN_PREFERENCES_PER_USER
protected void setup(org.apache.hadoop.mapreduce.Reducer.Context ctx) throws IOException, InterruptedException
setup
in class org.apache.hadoop.mapreduce.Reducer<VarLongWritable,VarLongWritable,VarLongWritable,VectorWritable>
IOException
InterruptedException
protected void reduce(VarLongWritable userID, Iterable<VarLongWritable> itemPrefs, org.apache.hadoop.mapreduce.Reducer.Context context) throws IOException, InterruptedException
reduce
in class org.apache.hadoop.mapreduce.Reducer<VarLongWritable,VarLongWritable,VarLongWritable,VectorWritable>
IOException
InterruptedException
Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.