org.apache.mahout.cf.taste.impl.recommender
Class AbstractCandidateItemsStrategy

java.lang.Object
  extended by org.apache.mahout.cf.taste.impl.recommender.AbstractCandidateItemsStrategy
All Implemented Interfaces:
Refreshable, CandidateItemsStrategy, MostSimilarItemsCandidateItemsStrategy
Direct Known Subclasses:
AllSimilarItemsCandidateItemsStrategy, AllUnknownItemsCandidateItemsStrategy, PreferredItemsNeighborhoodCandidateItemsStrategy, SamplingCandidateItemsStrategy

public abstract class AbstractCandidateItemsStrategy
extends Object
implements CandidateItemsStrategy, MostSimilarItemsCandidateItemsStrategy

Abstract base implementation for retrieving candidate items to recommend


Constructor Summary
AbstractCandidateItemsStrategy()
           
 
Method Summary
protected abstract  FastIDSet doGetCandidateItems(long[] preferredItemIDs, DataModel dataModel)
           
 FastIDSet getCandidateItems(long[] itemIDs, DataModel dataModel)
           
 FastIDSet getCandidateItems(long userID, PreferenceArray preferencesFromUser, DataModel dataModel)
           
 void refresh(Collection<Refreshable> alreadyRefreshed)
           Triggers "refresh" -- whatever that means -- of the implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCandidateItemsStrategy

public AbstractCandidateItemsStrategy()
Method Detail

getCandidateItems

public FastIDSet getCandidateItems(long userID,
                                   PreferenceArray preferencesFromUser,
                                   DataModel dataModel)
                            throws TasteException
Specified by:
getCandidateItems in interface CandidateItemsStrategy
Returns:
IDs of all items that could be recommended to the user
Throws:
TasteException

getCandidateItems

public FastIDSet getCandidateItems(long[] itemIDs,
                                   DataModel dataModel)
                            throws TasteException
Specified by:
getCandidateItems in interface MostSimilarItemsCandidateItemsStrategy
Throws:
TasteException

doGetCandidateItems

protected abstract FastIDSet doGetCandidateItems(long[] preferredItemIDs,
                                                 DataModel dataModel)
                                          throws TasteException
Throws:
TasteException

refresh

public void refresh(Collection<Refreshable> alreadyRefreshed)
Description copied from interface: Refreshable

Triggers "refresh" -- whatever that means -- of the implementation. The general contract is that any Refreshable should always leave itself in a consistent, operational state, and that the refresh atomically updates internal state from old to new.

Specified by:
refresh in interface Refreshable
Parameters:
alreadyRefreshed - Refreshables that are known to have already been refreshed as a result of an initial call to a Refreshable.refresh(Collection) method on some object. This ensure that objects in a refresh dependency graph aren't refreshed twice needlessly.


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.