org.apache.mahout.cf.taste.impl.recommender
Class GenericBooleanPrefUserBasedRecommender

java.lang.Object
  extended by org.apache.mahout.cf.taste.impl.recommender.AbstractRecommender
      extended by org.apache.mahout.cf.taste.impl.recommender.GenericUserBasedRecommender
          extended by org.apache.mahout.cf.taste.impl.recommender.GenericBooleanPrefUserBasedRecommender
All Implemented Interfaces:
Refreshable, Recommender, UserBasedRecommender

public final class GenericBooleanPrefUserBasedRecommender
extends GenericUserBasedRecommender

A variant on GenericUserBasedRecommender which is appropriate for use when no notion of preference value exists in the data.


Constructor Summary
GenericBooleanPrefUserBasedRecommender(DataModel dataModel, UserNeighborhood neighborhood, UserSimilarity similarity)
           
 
Method Summary
protected  float doEstimatePreference(long theUserID, long[] theNeighborhood, long itemID)
          This computation is in a technical sense, wrong, since in the domain of "boolean preference users" where all preference values are 1, this method should only ever return 1.0 or NaN.
protected  FastIDSet getAllOtherItems(long[] theNeighborhood, long theUserID)
           
 String toString()
           
 
Methods inherited from class org.apache.mahout.cf.taste.impl.recommender.GenericUserBasedRecommender
estimatePreference, getSimilarity, mostSimilarUserIDs, mostSimilarUserIDs, recommend, refresh
 
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

GenericBooleanPrefUserBasedRecommender

public GenericBooleanPrefUserBasedRecommender(DataModel dataModel,
                                              UserNeighborhood neighborhood,
                                              UserSimilarity similarity)
Method Detail

doEstimatePreference

protected float doEstimatePreference(long theUserID,
                                     long[] theNeighborhood,
                                     long itemID)
                              throws TasteException
This computation is in a technical sense, wrong, since in the domain of "boolean preference users" where all preference values are 1, this method should only ever return 1.0 or NaN. This isn't terribly useful however since it means results can't be ranked by preference value (all are 1). So instead this returns a sum of similarities to any other user in the neighborhood who has also rated the item.

Overrides:
doEstimatePreference in class GenericUserBasedRecommender
Throws:
TasteException

getAllOtherItems

protected FastIDSet getAllOtherItems(long[] theNeighborhood,
                                     long theUserID)
                              throws TasteException
Overrides:
getAllOtherItems in class GenericUserBasedRecommender
Throws:
TasteException

toString

public String toString()
Overrides:
toString in class GenericUserBasedRecommender


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.