Examples of recommend()


Examples of org.apache.mahout.cf.taste.recommender.Recommender.recommend()

    cachingRecommender.refresh(null);
    cachingRecommender.recommend(1, 1);
    assertEquals(3, recommendCount.get());
    cachingRecommender.recommend(2, 1);
    assertEquals(4, recommendCount.get());
    cachingRecommender.recommend(3, 1);
    assertEquals(5, recommendCount.get());

    // Results from this recommend() method can be cached...
    IDRescorer rescorer = NullRescorer.getItemInstance();
    cachingRecommender.refresh(null);
View Full Code Here

Examples of org.apache.mahout.cf.taste.recommender.Recommender.recommend()

    assertEquals(5, recommendCount.get());

    // Results from this recommend() method can be cached...
    IDRescorer rescorer = NullRescorer.getItemInstance();
    cachingRecommender.refresh(null);
    cachingRecommender.recommend(1, 1, rescorer);
    assertEquals(6, recommendCount.get());
    cachingRecommender.recommend(2, 1, rescorer);
    assertEquals(7, recommendCount.get());
    cachingRecommender.recommend(1, 1, rescorer);
    assertEquals(7, recommendCount.get());
View Full Code Here

Examples of org.apache.mahout.cf.taste.recommender.Recommender.recommend()

    // Results from this recommend() method can be cached...
    IDRescorer rescorer = NullRescorer.getItemInstance();
    cachingRecommender.refresh(null);
    cachingRecommender.recommend(1, 1, rescorer);
    assertEquals(6, recommendCount.get());
    cachingRecommender.recommend(2, 1, rescorer);
    assertEquals(7, recommendCount.get());
    cachingRecommender.recommend(1, 1, rescorer);
    assertEquals(7, recommendCount.get());
    cachingRecommender.recommend(2, 1, rescorer);
    assertEquals(7, recommendCount.get());
View Full Code Here

Examples of org.apache.mahout.cf.taste.recommender.Recommender.recommend()

    cachingRecommender.refresh(null);
    cachingRecommender.recommend(1, 1, rescorer);
    assertEquals(6, recommendCount.get());
    cachingRecommender.recommend(2, 1, rescorer);
    assertEquals(7, recommendCount.get());
    cachingRecommender.recommend(1, 1, rescorer);
    assertEquals(7, recommendCount.get());
    cachingRecommender.recommend(2, 1, rescorer);
    assertEquals(7, recommendCount.get());

    // until you switch Rescorers
View Full Code Here

Examples of org.apache.mahout.cf.taste.recommender.Recommender.recommend()

    assertEquals(6, recommendCount.get());
    cachingRecommender.recommend(2, 1, rescorer);
    assertEquals(7, recommendCount.get());
    cachingRecommender.recommend(1, 1, rescorer);
    assertEquals(7, recommendCount.get());
    cachingRecommender.recommend(2, 1, rescorer);
    assertEquals(7, recommendCount.get());

    // until you switch Rescorers
    cachingRecommender.recommend(1, 1, null);
    assertEquals(8, recommendCount.get());
View Full Code Here

Examples of org.apache.mahout.cf.taste.recommender.Recommender.recommend()

    assertEquals(7, recommendCount.get());
    cachingRecommender.recommend(2, 1, rescorer);
    assertEquals(7, recommendCount.get());

    // until you switch Rescorers
    cachingRecommender.recommend(1, 1, null);
    assertEquals(8, recommendCount.get());
    cachingRecommender.recommend(2, 1, null);
    assertEquals(9, recommendCount.get());

    cachingRecommender.refresh(null);
View Full Code Here

Examples of org.apache.mahout.cf.taste.recommender.Recommender.recommend()

    assertEquals(7, recommendCount.get());

    // until you switch Rescorers
    cachingRecommender.recommend(1, 1, null);
    assertEquals(8, recommendCount.get());
    cachingRecommender.recommend(2, 1, null);
    assertEquals(9, recommendCount.get());

    cachingRecommender.refresh(null);
    cachingRecommender.estimatePreference(1, 1);
    assertEquals(10, recommendCount.get());
View Full Code Here

Examples of org.apache.mahout.cf.taste.recommender.Recommender.recommend()

public final class ItemUserAverageRecommenderTest extends TasteTestCase {

  public void testRecommender() throws Exception {
    Recommender recommender = new ItemUserAverageRecommender(getDataModel());
    List<RecommendedItem> recommended = recommender.recommend(1, 1);
    assertNotNull(recommended);
    assertEquals(1, recommended.size());
    RecommendedItem firstRecommended = recommended.get(0);
    assertEquals(2, firstRecommended.getItemID());
    assertEquals(0.35151517f, firstRecommended.getValue());
View Full Code Here

Examples of org.apache.mahout.cf.taste.recommender.Recommender.recommend()

                    {0.4, 0.9},
            });
    UserSimilarity similarity = new PearsonCorrelationSimilarity(dataModel);
    ClusterSimilarity clusterSimilarity = new FarthestNeighborClusterSimilarity(similarity);
    Recommender recommender = new TreeClusteringRecommender(dataModel, clusterSimilarity, 2);
    List<RecommendedItem> recommended = recommender.recommend(1, 1);
    assertNotNull(recommended);
    assertEquals(0, recommended.size());
    recommender.refresh(null);
    assertNotNull(recommended);
    assertEquals(0, recommended.size());
View Full Code Here

Examples of org.apache.mahout.cf.taste.recommender.Recommender.recommend()

            });

    UserSimilarity similarity = new PearsonCorrelationSimilarity(dataModel);
    ClusterSimilarity clusterSimilarity = new FarthestNeighborClusterSimilarity(similarity);
    Recommender recommender = new TreeClusteringRecommender(dataModel, clusterSimilarity, 2);
    List<RecommendedItem> fewRecommended = recommender.recommend(1, 2);
    List<RecommendedItem> moreRecommended = recommender.recommend(1, 4);
    for (int i = 0; i < fewRecommended.size(); i++) {
      assertEquals(fewRecommended.get(i).getItemID(), moreRecommended.get(i).getItemID());
    }
    recommender.refresh(null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.