public final class SVDRecommender extends AbstractRecommender
Recommender
that uses matrix factorization (a projection of users
and items onto a feature space)Constructor and Description |
---|
SVDRecommender(DataModel dataModel,
Factorizer factorizer) |
SVDRecommender(DataModel dataModel,
Factorizer factorizer,
CandidateItemsStrategy candidateItemsStrategy) |
SVDRecommender(DataModel dataModel,
Factorizer factorizer,
CandidateItemsStrategy candidateItemsStrategy,
PersistenceStrategy persistenceStrategy)
Create an SVDRecommender using a persistent store to cache factorizations.
|
SVDRecommender(DataModel dataModel,
Factorizer factorizer,
PersistenceStrategy persistenceStrategy)
Create an SVDRecommender using a persistent store to cache factorizations.
|
Modifier and Type | Method and Description |
---|---|
float |
estimatePreference(long userID,
long itemID)
a preference is estimated by computing the dot-product of the user and item feature vectors
|
List<RecommendedItem> |
recommend(long userID,
int howMany,
IDRescorer rescorer,
boolean includeKnownItems) |
void |
refresh(Collection<Refreshable> alreadyRefreshed)
Refresh the data model and factorization.
|
getAllOtherItems, getDataModel, getDefaultCandidateItemsStrategy, recommend, recommend, recommend, removePreference, setPreference
public SVDRecommender(DataModel dataModel, Factorizer factorizer) throws TasteException
TasteException
public SVDRecommender(DataModel dataModel, Factorizer factorizer, CandidateItemsStrategy candidateItemsStrategy) throws TasteException
TasteException
public SVDRecommender(DataModel dataModel, Factorizer factorizer, PersistenceStrategy persistenceStrategy) throws TasteException
refresh
method recomputes the factorization and overwrites the store.dataModel
- factorizer
- persistenceStrategy
- TasteException
IOException
public SVDRecommender(DataModel dataModel, Factorizer factorizer, CandidateItemsStrategy candidateItemsStrategy, PersistenceStrategy persistenceStrategy) throws TasteException
refresh
method recomputes the factorization and overwrites the store.dataModel
- factorizer
- candidateItemsStrategy
- persistenceStrategy
- TasteException
public List<RecommendedItem> recommend(long userID, int howMany, IDRescorer rescorer, boolean includeKnownItems) throws TasteException
userID
- user for which recommendations are to be computedhowMany
- desired number of recommendationsrescorer
- rescoring function to apply before final list of recommendations is determinedincludeKnownItems
- whether to include items already known by the user in recommendationsList
of recommended RecommendedItem
s, ordered from most strongly recommend to
leastTasteException
- if an error occurs while accessing the DataModel
public float estimatePreference(long userID, long itemID) throws TasteException
userID
- user ID whose preference is to be estimateditemID
- item ID to estimate preference forDouble.NaN
TasteException
- if an error occurs while accessing the DataModel
public void refresh(Collection<Refreshable> alreadyRefreshed)
alreadyRefreshed
- Refreshable
s that are known to have already been
refreshed as a result of an initial call to a {#refresh(Collection)} method on some
object. This ensure that objects in a refresh dependency graph aren't refreshed twice
needlessly.Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.