org.apache.mahout.cf.taste.recommender.slopeone
Interface DiffStorage

All Superinterfaces:
Refreshable
All Known Implementing Classes:
FileDiffStorage, MemoryDiffStorage

public interface DiffStorage
extends Refreshable

Implementations store item-item preference diffs for a SlopeOneRecommender. It actually does a bit more for this implementation, like listing all items that may be considered for recommendation, in order to maximize what implementations can do to optimize the slope-one algorithm.

See Also:
SlopeOneRecommender

Method Summary
 void addItemPref(long userID, long itemID, float prefValue)
          Updates internal data structures to reflect a new preference value for an item.
 RunningAverage getAverageItemPref(long itemID)
           
 RunningAverage getDiff(long itemID1, long itemID2)
           
 RunningAverage[] getDiffs(long userID, long itemID, PreferenceArray prefs)
           
 FastIDSet getRecommendableItemIDs(long userID)
           
 void removeItemPref(long userID, long itemID, float prefValue)
          Updates internal data structures to reflect an update in a preference value for an item.
 void updateItemPref(long itemID, float prefDelta)
          Updates internal data structures to reflect an update in a preference value for an item.
 
Methods inherited from interface org.apache.mahout.cf.taste.common.Refreshable
refresh
 

Method Detail

getDiff

RunningAverage getDiff(long itemID1,
                       long itemID2)
                       throws TasteException
Returns:
RunningAverage encapsulating the average difference in preferences between items corresponding to itemID1 and itemID2, in that direction; that is, it's the average of item 2's preferences minus item 1's preferences
Throws:
TasteException

getDiffs

RunningAverage[] getDiffs(long userID,
                          long itemID,
                          PreferenceArray prefs)
                          throws TasteException
Parameters:
userID - user ID to get diffs for
itemID - itemID to assess
prefs - user's preferendces
Returns:
RunningAverages for that user's item-item diffs
Throws:
TasteException

getAverageItemPref

RunningAverage getAverageItemPref(long itemID)
                                  throws TasteException
Returns:
RunningAverage encapsulating the average preference for the given item
Throws:
TasteException

addItemPref

void addItemPref(long userID,
                 long itemID,
                 float prefValue)
                 throws TasteException

Updates internal data structures to reflect a new preference value for an item.

Parameters:
userID - user whose pref is being added
itemID - item to add preference value for
prefValue - new preference value
Throws:
TasteException

updateItemPref

void updateItemPref(long itemID,
                    float prefDelta)
                    throws TasteException

Updates internal data structures to reflect an update in a preference value for an item.

Parameters:
itemID - item to update preference value for
prefDelta - amount by which preference value changed
Throws:
TasteException

removeItemPref

void removeItemPref(long userID,
                    long itemID,
                    float prefValue)
                    throws TasteException

Updates internal data structures to reflect an update in a preference value for an item.

Parameters:
userID - user whose pref is being removed
itemID - item to update preference value for
prefValue - old preference value
Throws:
TasteException

getRecommendableItemIDs

FastIDSet getRecommendableItemIDs(long userID)
                                  throws TasteException
Returns:
item IDs that may possibly be recommended to the given user, which may not be all items since the item-item diff matrix may be sparse
Throws:
TasteException


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