org.apache.mahout.cf.taste.hadoop.item
Class ToUserVectorReducer

java.lang.Object
  extended by org.apache.hadoop.mapreduce.Reducer<VarLongWritable,VarLongWritable,VarLongWritable,VectorWritable>
      extended by org.apache.mahout.cf.taste.hadoop.item.ToUserVectorReducer

public final class ToUserVectorReducer
extends org.apache.hadoop.mapreduce.Reducer<VarLongWritable,VarLongWritable,VarLongWritable,VectorWritable>

Input

Takes user IDs as VarLongWritable mapped to all associated item IDs and preference values, as EntityPrefWritables.

Output

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.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.mapreduce.Reducer
org.apache.hadoop.mapreduce.Reducer.Context
 
Constructor Summary
ToUserVectorReducer()
           
 
Method Summary
protected  void reduce(VarLongWritable userID, java.lang.Iterable<VarLongWritable> itemPrefs, org.apache.hadoop.mapreduce.Reducer.Context context)
           
 
Methods inherited from class org.apache.hadoop.mapreduce.Reducer
cleanup, run, setup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToUserVectorReducer

public ToUserVectorReducer()
Method Detail

reduce

protected void reduce(VarLongWritable userID,
                      java.lang.Iterable<VarLongWritable> itemPrefs,
                      org.apache.hadoop.mapreduce.Reducer.Context context)
               throws java.io.IOException,
                      java.lang.InterruptedException
Overrides:
reduce in class org.apache.hadoop.mapreduce.Reducer<VarLongWritable,VarLongWritable,VarLongWritable,VectorWritable>
Throws:
java.io.IOException
java.lang.InterruptedException


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