GenericUserBasedRecommender extends AbstractRecommender implements UserBasedRecommender { @Override public float estimatePreference(long userID, long itemID) throws TasteException { DataModel model = getDataModel(); Float actualPref = model.getPreferenceValue(userID, itemID); if (actualPref != null) { return actualPref; } long[] theNeighborhood = neighborhood.getUserNeighborhood(userID); return doEstimatePreference(userID, theNeighborhood, itemID); } 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();  }
@Test public void testEstimatePref() throws Exception { Recommender recommender = buildRecommender(); assertEquals(0.1f, recommender.estimatePreference(1, 2), EPSILON); }