## org.apache.mahout.cf.taste.impl.recommender.knn
Class KnnItemBasedRecommender

    java.lang.Object
      org.apache.mahout.cf.taste.impl.recommender.AbstractRecommender
          org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender
              org.apache.mahout.cf.taste.impl.recommender.knn.KnnItemBasedRecommender

All Implemented Interfaces:
  Refreshable, ItemBasedRecommender, Recommender

    public final class KnnItemBasedRecommender

extends GenericItemBasedRecommender

The weights to compute the final predicted preferences are calculated using linear interpolation, through an `Optimizer`. This algorithm is based in the paper of Robert M. Bell and Yehuda Koren in ICDM '07.

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender
`GenericItemBasedRecommender.MostSimilarEstimator`

Constructor Summary
`KnnItemBasedRecommender(DataModel dataModel, ItemSimilarity similarity, Optimizer optimizer, CandidateItemsStrategy candidateItemsStrategy, int neighborhoodSize)`
`KnnItemBasedRecommender(DataModel dataModel, ItemSimilarity similarity, Optimizer optimizer, int neighborhoodSize)`

Method Summary
`protected float` `doEstimatePreference(long theUserID, long itemID)`

Methods inherited from class org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender
`estimatePreference, getSimilarity, mostSimilarItems, mostSimilarItems, mostSimilarItems, mostSimilarItems, recommend, recommendedBecause, refresh, toString`

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, wait, wait, wait`

Methods inherited from interface org.apache.mahout.cf.taste.recommender.Recommender
`getDataModel, recommend, removePreference, setPreference`

Constructor Detail

### KnnItemBasedRecommender

    public KnnItemBasedRecommender(DataModel dataModel,
                                   ItemSimilarity similarity,
                                   Optimizer optimizer,
                                   CandidateItemsStrategy candidateItemsStrategy,
                                   int neighborhoodSize)

### KnnItemBasedRecommender

    public KnnItemBasedRecommender(DataModel dataModel,
                                   ItemSimilarity similarity,
                                   Optimizer optimizer,
                                   int neighborhoodSize)

Method Detail

### doEstimatePreference

    protected float doEstimatePreference(long theUserID,
                                         long itemID)
                                  throws TasteException

  Overrides:
    `doEstimatePreference` in class `GenericItemBasedRecommender`
  Throws:
    `TasteException`

Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.