@Test public void testMostSimilarToMultiple() throws Exception { ItemBasedRecommender recommender = buildRecommender2(); List<RecommendedItem> similar = recommender.mostSimilarItems(new long[] {0, 1}, 2); assertNotNull(similar); assertEquals(2, similar.size()); RecommendedItem first = similar.get(0); RecommendedItem second = similar.get(1); assertEquals(2, first.getItemID()); assertEquals(0.85f, first.getValue(), EPSILON); assertEquals(3, second.getItemID()); assertEquals(-0.3f, second.getValue(), EPSILON); }
@Override public List<RecommendedItem> mostSimilarItems(long itemID, int howMany) throws TasteException { return mostSimilarItems(itemID, howMany, null); }
GenericItemBasedRecommender extends AbstractRecommender implements ItemBasedRecommender { @Override public List<RecommendedItem> mostSimilarItems(long itemID, int howMany) throws TasteException { return mostSimilarItems(itemID, howMany, null); } }
GenericItemBasedRecommender extends AbstractRecommender implements ItemBasedRecommender { @Override public List<RecommendedItem> mostSimilarItems(long itemID, int howMany) throws TasteException { return mostSimilarItems(itemID, howMany, null); } GenericItemBasedRecommender(DataModel dataModel,
                                     ItemSimilarity similarity,
                                     CandidateItemsStrategy candidateItemsStrategy,
                                     MostSimilarItemsCandidateItemsStrategy mostSimilarItemsCandidateItemsStrategy);  GenericItemBasedRecommender(DataModel dataModel, ItemSimilarity similarity); }
GenericItemBasedRecommender extends AbstractRecommender implements ItemBasedRecommender { @Override public List<RecommendedItem> mostSimilarItems(long itemID, int howMany) throws TasteException { return mostSimilarItems(itemID, howMany, null); } GenericItemBasedRecommender(DataModel dataModel,
                                     ItemSimilarity similarity,
                                     CandidateItemsStrategy candidateItemsStrategy,
                                     MostSimilarItemsCandidateItemsStrategy mostSimilarItemsCandidateItemsStrategy);  GenericItemBasedRecommender(DataModel dataModel, ItemSimilarity similarity); ItemSimilarity getSimilarity(); @Override List<RecommendedItem> recommend(long userID, int howMany, IDRescorer rescorer, boolean includeKnownItems); @Override float estimatePreference(long userID, long itemID); @Override List<RecommendedItem> mostSimilarItems(long itemID, int howMany); @Override List<RecommendedItem> mostSimilarItems(long itemID, int howMany,
                                                Rescorer<LongPair> rescorer); @Override List<RecommendedItem> mostSimilarItems(long[] itemIDs, int howMany); @Override List<RecommendedItem> mostSimilarItems(long[] itemIDs, int howMany,
                                                Rescorer<LongPair> rescorer); @Override List<RecommendedItem> mostSimilarItems(long[] itemIDs,
                                                int howMany,
                                                boolean excludeItemIfNotSimilarToAll); @Override List<RecommendedItem> mostSimilarItems(long[] itemIDs, int howMany,
                                                Rescorer<LongPair> rescorer,
                                                boolean excludeItemIfNotSimilarToAll); @Override List<RecommendedItem> recommendedBecause(long userID, long itemID, int howMany); @Override void refresh(Collection<Refreshable> alreadyRefreshed); @Override String toString(); }
GenericItemBasedRecommender extends AbstractRecommender implements ItemBasedRecommender { @Override public List<RecommendedItem> mostSimilarItems(long itemID, int howMany) throws TasteException { return mostSimilarItems(itemID, howMany, null); } GenericItemBasedRecommender(DataModel dataModel,
                                     ItemSimilarity similarity,
                                     CandidateItemsStrategy candidateItemsStrategy,
                                     MostSimilarItemsCandidateItemsStrategy mostSimilarItemsCandidateItemsStrategy);  GenericItemBasedRecommender(DataModel dataModel, ItemSimilarity similarity); ItemSimilarity getSimilarity(); @Override List<RecommendedItem> recommend(long userID, int howMany, IDRescorer rescorer, boolean includeKnownItems); @Override float estimatePreference(long userID, long itemID); @Override List<RecommendedItem> mostSimilarItems(long itemID, int howMany); @Override List<RecommendedItem> mostSimilarItems(long itemID, int howMany,
                                                Rescorer<LongPair> rescorer); @Override List<RecommendedItem> mostSimilarItems(long[] itemIDs, int howMany); @Override List<RecommendedItem> mostSimilarItems(long[] itemIDs, int howMany,
                                                Rescorer<LongPair> rescorer); @Override List<RecommendedItem> mostSimilarItems(long[] itemIDs,
                                                int howMany,
                                                boolean excludeItemIfNotSimilarToAll); @Override List<RecommendedItem> mostSimilarItems(long[] itemIDs, int howMany,
                                                Rescorer<LongPair> rescorer,
                                                boolean excludeItemIfNotSimilarToAll); @Override List<RecommendedItem> recommendedBecause(long userID, long itemID, int howMany); @Override void refresh(Collection<Refreshable> alreadyRefreshed); @Override String toString();  }