コード例 #1
0
        private IList <RecommendedItem> DoMostSimilarItems(Object itemID,
                                                           int howMany,
                                                           TopItems.Estimator <Item> estimator)
        {
            DataModel          model    = this.DataModel;
            Item               toItem   = model.GetItem(itemID);
            ICollection <Item> allItems = new HashedSet <Item>(/*Model.GetNumItems()*/);

            foreach (Item item in model.GetItems())
            {
                allItems.Add(item);
            }
            allItems.Remove(toItem);
            return(TopItems.GetTopItems(howMany, allItems, NullRescorer <Item> .Instance, estimator));
        }
コード例 #2
0
        private IList <User> DoMostSimilarUsers(Object userID,
                                                int howMany,
                                                TopItems.Estimator <User> estimator)
        {
            DataModel          model    = this.DataModel;
            User               toUser   = model.GetUser(userID);
            ICollection <User> allUsers = new HashedSet <User>(/*Model.GetNumUsers()*/);

            foreach (User user in model.GetUsers())
            {
                allUsers.Add(user);
            }
            allUsers.Remove(toUser);
            return(TopItems.GetTopUsers(howMany, allUsers, NullRescorer <User> .Instance, estimator));
        }
コード例 #3
0
        private List <RecommendedItem> doMostSimilarItems(long[] itemIDs, int howMany, TopItems.Estimator <long> estimator)
        {
            FastIDSet set = this.mostSimilarItemsCandidateItemsStrategy.getCandidateItems(itemIDs, this.getDataModel());

            return(TopItems.getTopItems(howMany, set.GetEnumerator(), null, estimator));
        }
コード例 #4
0
        private long[] doMostSimilarUsers(int howMany, TopItems.Estimator <long> estimator)
        {
            DataModel model = this.getDataModel();

            return(TopItems.getTopUsers(howMany, model.getUserIDs(), null, estimator));
        }