edu.qut.cs.rcmd.core.tag.recommender.impl
Class AbstractTagRecommender

java.lang.Object
  extended by edu.qut.cs.rcmd.core.tag.recommender.impl.AbstractTagRecommender
All Implemented Interfaces:
TagRecommender
Direct Known Subclasses:
GenericUserBasedTagRecommender

public class AbstractTagRecommender
extends Object
implements TagRecommender

Author:
n7374186

Constructor Summary
protected AbstractTagRecommender(org.apache.mahout.cf.taste.model.DataModel dataModel, TagModel tagModel)
           
protected AbstractTagRecommender(org.apache.mahout.cf.taste.model.DataModel dataModel, TagModel tagModel, CandidateTagsStrategy candidateTagsStrategy)
           
 
Method Summary
 float estimateTagScore(long userID, long itemID, String tag)
           
protected  Set<String> getCandidateTags(long userID, long itemID, org.apache.mahout.cf.taste.model.PreferenceArray preferencesFromUser)
           
 org.apache.mahout.cf.taste.model.DataModel getDataModel()
           
protected static CandidateTagsStrategy getDefaultCandidateTagsStrategy()
           
 TagModel getTagModel()
           
 List<RecommendedTag> recommend(long userID, long itemID, int howMany)
           
 List<RecommendedTag> recommend(long userID, long itemID, int howMany, org.apache.mahout.cf.taste.recommender.IDRescorer rescorer)
           
 void removeTagScore(long userID, long itemID, String tag)
           
 void setTagScore(long userID, long itemID, String tag, float value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTagRecommender

protected AbstractTagRecommender(org.apache.mahout.cf.taste.model.DataModel dataModel,
                                 TagModel tagModel,
                                 CandidateTagsStrategy candidateTagsStrategy)

AbstractTagRecommender

protected AbstractTagRecommender(org.apache.mahout.cf.taste.model.DataModel dataModel,
                                 TagModel tagModel)
Method Detail

getDefaultCandidateTagsStrategy

protected static CandidateTagsStrategy getDefaultCandidateTagsStrategy()

recommend

public List<RecommendedTag> recommend(long userID,
                                      long itemID,
                                      int howMany)
                               throws org.apache.mahout.cf.taste.common.TasteException
Specified by:
recommend in interface TagRecommender
Parameters:
userID - user for which recommendations are to be computed
itemID - item for which recommendations are to be computed
howMany - desired number of recommendations
Returns:
List of recommended RecommendedTags, ordered from most strongly recommend to least
Throws:
org.apache.mahout.cf.taste.common.TasteException - if an error occurs while accessing the DataModel

recommend

public List<RecommendedTag> recommend(long userID,
                                      long itemID,
                                      int howMany,
                                      org.apache.mahout.cf.taste.recommender.IDRescorer rescorer)
                               throws org.apache.mahout.cf.taste.common.TasteException
Specified by:
recommend in interface TagRecommender
Parameters:
userID - user for which recommendations are to be computed
itemID - item 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 RecommendedItems, ordered from most strongly recommend to least
Throws:
org.apache.mahout.cf.taste.common.TasteException - if an error occurs while accessing the DataModel

getDataModel

public org.apache.mahout.cf.taste.model.DataModel getDataModel()
Specified by:
getDataModel in interface TagRecommender
Returns:
underlying DataModel used by this implementation currently using TagModel interface from core.model.tag (Soloman's)

getTagModel

public TagModel getTagModel()
Specified by:
getTagModel in interface TagRecommender

estimateTagScore

public float estimateTagScore(long userID,
                              long itemID,
                              String tag)
                       throws org.apache.mahout.cf.taste.common.TasteException
Specified by:
estimateTagScore in interface TagRecommender
Parameters:
userID - user ID whose tag score is to be estimated
itemID - item ID to estimate tag score for
tag - tag to estimate tag score for
Returns:
an estimated tag score if the tag has not been expressed a tag score for the item for this user, or else the actual tag score for the tag. If a tag score cannot be estimated, returns Double.NaN
Throws:
org.apache.mahout.cf.taste.common.TasteException - if an error occurs while accessing the DataModel

setTagScore

public void setTagScore(long userID,
                        long itemID,
                        String tag,
                        float value)
                 throws org.apache.mahout.cf.taste.common.TasteException
Specified by:
setTagScore in interface TagRecommender
Parameters:
userID - user to set tag score for
itemID - item to set tag score for
tag - tag to set tag score for
value - tag score value
Throws:
org.apache.mahout.cf.taste.common.TasteException - if an error occurs while accessing the DataModel

removeTagScore

public void removeTagScore(long userID,
                           long itemID,
                           String tag)
                    throws org.apache.mahout.cf.taste.common.TasteException
Specified by:
removeTagScore in interface TagRecommender
Parameters:
userID - user from which to remove tag score
itemID - item for which to remove tag score
tag - tag for which to remove tag score
Throws:
org.apache.mahout.cf.taste.common.TasteException - if an error occurs while accessing the DataModel

getCandidateTags

protected Set<String> getCandidateTags(long userID,
                                       long itemID,
                                       org.apache.mahout.cf.taste.model.PreferenceArray preferencesFromUser)
                                throws org.apache.mahout.cf.taste.common.TasteException
Throws:
org.apache.mahout.cf.taste.common.TasteException


Copyright © 2012. All Rights Reserved.