Ejemplo n.º 1
0
 private List <RecommendedItem> mostSimilarItems(long itemID,
                                                 IEnumerator <long> possibleItemIDs,
                                                 int howMany,
                                                 Rescorer <Tuple <long, long> > rescorer)
 {
     TopItems.Estimator <long> estimator = new MostSimilarEstimator(itemID, getSimilarity(), rescorer);
     return(TopItems.getTopItems(howMany, possibleItemIDs, null, estimator));
 }
Ejemplo n.º 2
0
        public override List <RecommendedItem> recommend(long userID, int howMany, IDRescorer rescorer)
        {
            log.debug("Recommending items for user ID '{}'", new object[] { userID });
            PreferenceArray        preferencesFromUser = this.getDataModel().getPreferencesFromUser(userID);
            List <RecommendedItem> list = TopItems.getTopItems(howMany, this.getAllOtherItems(userID, preferencesFromUser).GetEnumerator(), rescorer, new Estimator(this, userID));

            log.debug("Recommendations are: {}", new object[] { list });
            return(list);
        }
Ejemplo n.º 3
0
        public override List <RecommendedItem> recommend(long userID, int howMany, taste.recommender.IDRescorer rescorer)
        {
            //Preconditions.checkArgument(howMany >= 1, "howMany must be at least 1");
            log.debug("Recommending items for user ID '{}'", userID);

            FastIDSet possibleItemIDs = diffStorage.getRecommendableItemIDs(userID);

            TopItems.Estimator <long> estimator = new Estimator(this, userID);

            List <RecommendedItem> topItems = TopItems.getTopItems(howMany, possibleItemIDs.GetEnumerator(), rescorer, estimator);

            log.debug("Recommendations are: {}", topItems);
            return(topItems);
        }
Ejemplo n.º 4
0
        private List <RecommendedItem> computeTopRecsForCluster(FastIDSet cluster)
        {
            DataModel dataModel       = getDataModel();
            FastIDSet possibleItemIDs = new FastIDSet();
            var       it = cluster.GetEnumerator();

            while (it.MoveNext())
            {
                possibleItemIDs.addAll(dataModel.getItemIDsFromUser(it.Current));
            }

            TopItems.Estimator <long> estimator = new Estimator(cluster, this);

            List <RecommendedItem> topItems = TopItems.getTopItems(NUM_CLUSTER_RECS,
                                                                   possibleItemIDs.GetEnumerator(), null, estimator);

            log.debug("Recommendations are: {}", topItems);
            return(topItems);
        }