## org.apache.mahout.cf.taste.impl.recommender.svd
Class SVDRecommender

    java.lang.Object
      org.apache.mahout.cf.taste.impl.recommender.AbstractRecommender
          org.apache.mahout.cf.taste.impl.recommender.svd.SVDRecommender

All Implemented Interfaces:
  Refreshable, Recommender

    public final class SVDRecommender

extends AbstractRecommender

A `Recommender` that uses matrix factorization (a projection of users and items onto a feature space)

Constructor Summary
`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.

Method Summary
`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)`
`void` `refresh(Collection<Refreshable> alreadyRefreshed)` Refresh the data model and factorization.

Methods inherited from class org.apache.mahout.cf.taste.impl.recommender.AbstractRecommender
`getAllOtherItems, getDataModel, getDefaultCandidateItemsStrategy, recommend, removePreference, setPreference`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SVDRecommender

    public SVDRecommender(DataModel dataModel,
                          Factorizer factorizer)
                   throws TasteException

Throws:
  `TasteException`

### SVDRecommender

    public SVDRecommender(DataModel dataModel,
                          Factorizer factorizer,
                          CandidateItemsStrategy candidateItemsStrategy)
                   throws TasteException

Throws:
  `TasteException`

### SVDRecommender

    public SVDRecommender(DataModel dataModel,
                          Factorizer factorizer,
                          PersistenceStrategy persistenceStrategy)
                   throws TasteException

  Create an SVDRecommender using a persistent store to cache factorizations. A factorization is loaded from the store if present, otherwise a new factorization is computed and saved in the store. The `refresh` method recomputes the factorization and overwrites the store.

  Parameters:
    `dataModel` -
    `factorizer` -
    `persistenceStrategy` -
  Throws:
    `TasteException`
    `IOException`

### SVDRecommender

    public SVDRecommender(DataModel dataModel,
                          Factorizer factorizer,
                          CandidateItemsStrategy candidateItemsStrategy,
                          PersistenceStrategy persistenceStrategy)
                   throws TasteException

  Create an SVDRecommender using a persistent store to cache factorizations. A factorization is loaded from the store if present, otherwise a new factorization is computed and saved in the store. The `refresh` method recomputes the factorization and overwrites the store.

  Parameters:
    `dataModel` -
    `factorizer` -
    `candidateItemsStrategy` -
    `persistenceStrategy` -
  Throws:
    `TasteException`

Method Detail

### recommend

    public List<RecommendedItem> recommend(long userID,
                                           int howMany,
                                           IDRescorer rescorer)
                                    throws TasteException

  Parameters:
    `userID` - user for which recommendations are to be computed
    `howMany` - desired number of recommendations
    `rescorer` - rescoring function to apply before final list of recommendations is determined
  Returns:
    `List` of recommended `RecommendedItem`s, ordered from most strongly recommend to least
  Throws:
    `TasteException` - if an error occurs while accessing the `DataModel`

### estimatePreference

    public float estimatePreference(long userID,
                                    long itemID)
                             throws TasteException

  a preference is estimated by computing the dot-product of the user and item feature vectors

  Parameters:
    `userID` - user ID whose preference is to be estimated
    `itemID` - item ID to estimate preference for
  Returns:
    an estimated preference if the user has not expressed a preference for the item, or else the user's actual preference for the item. If a preference cannot be estimated, returns `Double.NaN`
  Throws:
    `TasteException` - if an error occurs while accessing the `DataModel`

### refresh

    public void refresh(Collection<Refreshable> alreadyRefreshed)

  Refresh the data model and factorization.

  Parameters:
    `alreadyRefreshed` - `Refreshable`s 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.