/** * {@inheritDoc} */ public override IList <RecommendedItem> Recommend(Object userID, int howMany, Rescorer <Item> rescorer) { if (userID == null) { throw new ArgumentNullException("userID is null"); } if (howMany < 1) { throw new ArgumentException("howMany must be at least 1"); } if (rescorer == null) { throw new ArgumentNullException("rescorer is null"); } if (log.IsDebugEnabled) { log.Debug("Recommending items for user ID '" + userID + '\''); } User theUser = this.DataModel.GetUser(userID); ISet <Item> allItems = diffStorage.GetRecommendableItems(userID); TopItems.Estimator <Item> estimator = new Estimator(this, theUser); IList <RecommendedItem> topItems = TopItems.GetTopItems(howMany, allItems, rescorer, estimator); if (log.IsDebugEnabled) { log.Debug("Recommendations are: " + topItems); } return(topItems); }
public override IList <IRecommendedItem> Recommend(long userID, int howMany, IDRescorer rescorer) { //Preconditions.checkArgument(howMany >= 1, "howMany must be at least 1"); log.Debug("Recommending items for user ID '{}'", userID); IPreferenceArray preferencesFromUser = GetDataModel().GetPreferencesFromUser(userID); FastIDSet possibleItemIDs = GetAllOtherItems(userID, preferencesFromUser); List <IRecommendedItem> topItems = TopItems.GetTopItems(howMany, possibleItemIDs.GetEnumerator(), rescorer, new Estimator(this, userID)); log.Debug("Recommendations are: {}", topItems); return(topItems); }