public IList <RecommendedItem> MostSimilarItems(List <Object> itemIDs,
                                                        int howMany,
                                                        Rescorer <Pair <Item, Item> > rescorer)
        {
            if (rescorer == null)
            {
                throw new ArgumentNullException("rescorer is null");
            }
            DataModel   model   = this.DataModel;
            List <Item> toItems = new List <Item>(itemIDs.Count);

            foreach (Object itemID in itemIDs)
            {
                toItems.Add(model.GetItem(itemID));
            }
            TopItems.Estimator <Item> estimator = new MultiMostSimilarEstimator(toItems, correlation, rescorer);
            ICollection <Item>        allItems  = new HashedSet <Item>(/*Model.GetNumItems()*/);

            foreach (Item item in model.GetItems())
            {
                allItems.Add(item);
            }
            foreach (Item item in toItems)
            {
                allItems.Remove(item);
            }
            return(TopItems.GetTopItems(howMany, allItems, NullRescorer <Item> .Instance, estimator));
        }
Exemplo n.º 2
0
 public List <IRecommendedItem> MostSimilarItems(long[] itemIDs, int howMany,
                                                 IRescorer <Tuple <long, long> > rescorer)
 {
     TopItems.IEstimator <long> estimator = new MultiMostSimilarEstimator(itemIDs, similarity, rescorer,
                                                                          EXCLUDE_ITEM_IF_NOT_SIMILAR_TO_ALL_BY_DEFAULT);
     return(doMostSimilarItems(itemIDs, howMany, estimator));
 }
Exemplo n.º 3
0
 public List <IRecommendedItem> MostSimilarItems(long[] itemIDs, int howMany,
                                                 IRescorer <Tuple <long, long> > rescorer,
                                                 bool excludeItemIfNotSimilarToAll)
 {
     TopItems.IEstimator <long> estimator = new MultiMostSimilarEstimator(itemIDs, similarity, rescorer,
                                                                          excludeItemIfNotSimilarToAll);
     return(doMostSimilarItems(itemIDs, howMany, estimator));
 }
Exemplo n.º 4
0
 public List <RecommendedItem> mostSimilarItems(long[] itemIDs, int howMany, bool excludeItemIfNotSimilarToAll)
 {
     TopItems.Estimator <long> estimator = new MultiMostSimilarEstimator(itemIDs, this.similarity, null, excludeItemIfNotSimilarToAll);
     return(this.doMostSimilarItems(itemIDs, howMany, estimator));
 }
Exemplo n.º 5
0
 public List <RecommendedItem> mostSimilarItems(long[] itemIDs, int howMany)
 {
     TopItems.Estimator <long> estimator = new MultiMostSimilarEstimator(itemIDs, this.similarity, null, EXCLUDE_ITEM_IF_NOT_SIMILAR_TO_ALL_BY_DEFAULT);
     return(this.doMostSimilarItems(itemIDs, howMany, estimator));
 }