Computes a neighborhood consisting of the nearest n users to a given user. "Nearest" is defined by the given {@link UserSimilarity}.
8182838485868788899091
{0.1, 0.2}, {0.2, 0.3, 0.3, 0.6}, {0.4, 0.5, 0.5, 0.9}, }); UserSimilarity similarity = new PearsonCorrelationSimilarity(dataModel); UserNeighborhood neighborhood = new NearestNUserNeighborhood(2, similarity, dataModel); Recommender recommender = new GenericUserBasedRecommender(dataModel, neighborhood, similarity); List<RecommendedItem> originalRecommended = recommender.recommend(1, 2); List<RecommendedItem> rescoredRecommended = recommender.recommend(1, 2, new ReversingRescorer<Long>()); assertNotNull(originalRecommended);