public abstract class RecommenderWrapper extends Object implements Recommender
Recommender implementation with a no-arg constructor,
which will internally build the desired Recommender and delegate
to it. This wrapper simplifies that process. Simply extend this class and
implement buildRecommender().| Modifier | Constructor and Description |
|---|---|
protected |
RecommenderWrapper() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract Recommender |
buildRecommender() |
float |
estimatePreference(long userID,
long itemID) |
DataModel |
getDataModel() |
static File |
readResourceToTempFile(String resourceName)
Reads the given resource into a temporary file.
|
List<RecommendedItem> |
recommend(long userID,
int howMany) |
List<RecommendedItem> |
recommend(long userID,
int howMany,
IDRescorer rescorer) |
void |
refresh(Collection<Refreshable> alreadyRefreshed) |
void |
removePreference(long userID,
long itemID) |
void |
setPreference(long userID,
long itemID,
float value) |
protected RecommenderWrapper()
throws TasteException,
IOException
TasteExceptionIOExceptionprotected abstract Recommender buildRecommender() throws IOException, TasteException
Recommender which should be used to produce recommendations
by this wrapper implementationIOExceptionTasteExceptionpublic List<RecommendedItem> recommend(long userID, int howMany) throws TasteException
recommend in interface RecommenderTasteExceptionpublic List<RecommendedItem> recommend(long userID, int howMany, IDRescorer rescorer) throws TasteException
recommend in interface RecommenderTasteExceptionpublic float estimatePreference(long userID,
long itemID)
throws TasteException
estimatePreference in interface RecommenderTasteExceptionpublic void setPreference(long userID,
long itemID,
float value)
throws TasteException
setPreference in interface RecommenderTasteExceptionpublic void removePreference(long userID,
long itemID)
throws TasteException
removePreference in interface RecommenderTasteExceptionpublic DataModel getDataModel()
getDataModel in interface Recommenderpublic void refresh(Collection<Refreshable> alreadyRefreshed)
refresh in interface Refreshablepublic static File readResourceToTempFile(String resourceName) throws IOException
resourceName - name of resource in classpath, or relative path to fileFile with resource dataIOException - if an error occurs while reading or writing dataCopyright © 2008–2013 The Apache Software Foundation. All rights reserved.