@Test public void testIsolatedUser() throws Exception { DataModel dataModel = getDataModel( new long[] {1, 2, 3, 4}, new Double[][] { {0.1, 0.2}, {0.2, 0.3, 0.3, 0.6}, {0.4, 0.4, 0.5, 0.9}, {null, null, null, null, 1.0}, }); UserSimilarity similarity = new PearsonCorrelationSimilarity(dataModel); UserNeighborhood neighborhood = new NearestNUserNeighborhood(3, similarity, dataModel); UserBasedRecommender recommender = new GenericUserBasedRecommender(dataModel, neighborhood, similarity); long[] mostSimilar = recommender.mostSimilarUserIDs(4, 3); assertNotNull(mostSimilar); assertEquals(0, mostSimilar.length); }
@Override public long[] mostSimilarUserIDs(long userID, int howMany) throws TasteException { return mostSimilarUserIDs(userID, howMany, null); }
GenericUserBasedRecommender extends AbstractRecommender implements UserBasedRecommender { @Override public long[] mostSimilarUserIDs(long userID, int howMany) throws TasteException { return mostSimilarUserIDs(userID, howMany, null); } }
GenericUserBasedRecommender extends AbstractRecommender implements UserBasedRecommender { @Override public long[] mostSimilarUserIDs(long userID, int howMany) throws TasteException { return mostSimilarUserIDs(userID, howMany, null); } GenericUserBasedRecommender(DataModel dataModel,
                                     UserNeighborhood neighborhood,
                                     UserSimilarity similarity); }
GenericUserBasedRecommender extends AbstractRecommender implements UserBasedRecommender { @Override public long[] mostSimilarUserIDs(long userID, int howMany) throws TasteException { return mostSimilarUserIDs(userID, howMany, null); } GenericUserBasedRecommender(DataModel dataModel,
                                     UserNeighborhood neighborhood,
                                     UserSimilarity similarity); UserSimilarity getSimilarity(); @Override List<RecommendedItem> recommend(long userID, int howMany, IDRescorer rescorer, boolean includeKnownItems); @Override float estimatePreference(long userID, long itemID); @Override long[] mostSimilarUserIDs(long userID, int howMany); @Override long[] mostSimilarUserIDs(long userID, int howMany, Rescorer<LongPair> rescorer); @Override void refresh(Collection<Refreshable> alreadyRefreshed); @Override String toString(); }
GenericUserBasedRecommender extends AbstractRecommender implements UserBasedRecommender { @Override public long[] mostSimilarUserIDs(long userID, int howMany) throws TasteException { return mostSimilarUserIDs(userID, howMany, null); } GenericUserBasedRecommender(DataModel dataModel,
                                     UserNeighborhood neighborhood,
                                     UserSimilarity similarity); UserSimilarity getSimilarity(); @Override List<RecommendedItem> recommend(long userID, int howMany, IDRescorer rescorer, boolean includeKnownItems); @Override float estimatePreference(long userID, long itemID); @Override long[] mostSimilarUserIDs(long userID, int howMany); @Override long[] mostSimilarUserIDs(long userID, int howMany, Rescorer<LongPair> rescorer); @Override void refresh(Collection<Refreshable> alreadyRefreshed); @Override String toString();  }