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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
recommend, recommend
protected RecommenderWrapper() throws TasteException, IOException
TasteException
IOException
protected abstract Recommender buildRecommender() throws IOException, TasteException
Recommender
which should be used to produce recommendations
by this wrapper implementationIOException
TasteException
public List<RecommendedItem> recommend(long userID, int howMany) throws TasteException
recommend
in interface Recommender
TasteException
public List<RecommendedItem> recommend(long userID, int howMany, IDRescorer rescorer) throws TasteException
recommend
in interface Recommender
TasteException
public float estimatePreference(long userID, long itemID) throws TasteException
estimatePreference
in interface Recommender
TasteException
public void setPreference(long userID, long itemID, float value) throws TasteException
setPreference
in interface Recommender
TasteException
public void removePreference(long userID, long itemID) throws TasteException
removePreference
in interface Recommender
TasteException
public DataModel getDataModel()
getDataModel
in interface Recommender
public void refresh(Collection<Refreshable> alreadyRefreshed)
refresh
in interface Refreshable
public 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–2015 The Apache Software Foundation. All rights reserved.