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

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

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
 RunningAverage getAverageItemPref(long itemID)
           
 RunningAverage getDiff(long itemID1, long itemID2)
           
 RunningAverage[] getDiffs(long userID, long itemID, PreferenceArray prefs)
           
 FastIDSet getRecommendableItemIDs(long userID)
           
 void updateItemPref(long itemID, float prefDelta, boolean remove)
           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

updateItemPref

void updateItemPref(long itemID,
                    float prefDelta,
                    boolean remove)
                    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 (or its old value, if being removed
remove - if true, operation reflects a removal rather than change of preference
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-2010 The Apache Software Foundation. All Rights Reserved.