Package org.apache.mahout.cf.taste.recommender

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


    List<RecommendedItem> fewRecommended = recommender.recommend("test1", 2);
    List<RecommendedItem> moreRecommended = recommender.recommend("test1", 4);
    for (int i = 0; i < fewRecommended.size(); i++) {
      assertEquals(fewRecommended.get(i).getItem(), moreRecommended.get(i).getItem());
    }
    recommender.refresh(null);
    for (int i = 0; i < fewRecommended.size(); i++) {
      assertEquals(fewRecommended.get(i).getItem(), moreRecommended.get(i).getItem());
    }
  }
View Full Code Here


    List<RecommendedItem> fewRecommended = recommender.recommend("test1", 2);
    List<RecommendedItem> moreRecommended = recommender.recommend("test1", 4);
    for (int i = 0; i < fewRecommended.size(); i++) {
      assertEquals(fewRecommended.get(i).getItem(), moreRecommended.get(i).getItem());
    }
    recommender.refresh(null);
    for (int i = 0; i < fewRecommended.size(); i++) {
      assertEquals(fewRecommended.get(i).getItem(), moreRecommended.get(i).getItem());
    }
  }
View Full Code Here

    assertNotNull(recommended);
    assertEquals(1, recommended.size());
    RecommendedItem firstRecommended = recommended.get(0);
    assertEquals(new GenericItem<String>("2"), firstRecommended.getItem());
    assertEquals(0.3, firstRecommended.getValue());
    recommender.refresh(null);
    assertEquals(new GenericItem<String>("2"), firstRecommended.getItem());
    assertEquals(0.3, firstRecommended.getValue());
  }

  public void testHowMany() throws Exception {
View Full Code Here

    List<RecommendedItem> fewRecommended = recommender.recommend("test1", 2);
    List<RecommendedItem> moreRecommended = recommender.recommend("test1", 4);
    for (int i = 0; i < fewRecommended.size(); i++) {
      assertEquals(fewRecommended.get(i).getItem(), moreRecommended.get(i).getItem());
    }
    recommender.refresh(null);
    for (int i = 0; i < fewRecommended.size(); i++) {
      assertEquals(fewRecommended.get(i).getItem(), moreRecommended.get(i).getItem());
    }
  }
View Full Code Here

    assertEquals(2, recommendCount.get());
    cachingRecommender.recommend("1", 1);
    assertEquals(2, recommendCount.get());
    cachingRecommender.recommend("2", 1);
    assertEquals(2, recommendCount.get());
    cachingRecommender.refresh(null);
    cachingRecommender.recommend("1", 1);
    assertEquals(3, recommendCount.get());
    cachingRecommender.recommend("2", 1);
    assertEquals(4, recommendCount.get());
    cachingRecommender.recommend("3", 1);
View Full Code Here

    cachingRecommender.recommend("3", 1);
    assertEquals(5, recommendCount.get());

    // Results from this recommend() method can be cached...
    Rescorer<Item> 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);
View Full Code Here

    cachingRecommender.recommend("1", 1, null);
    assertEquals(8, recommendCount.get());
    cachingRecommender.recommend("2", 1, null);
    assertEquals(9, recommendCount.get());

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

    assertNotNull(recommended);
    assertEquals(1, recommended.size());
    RecommendedItem firstRecommended = recommended.get(0);
    assertEquals(new GenericItem<String>("2"), firstRecommended.getItem());
    assertEquals(0.1, firstRecommended.getValue(), EPSILON);
    recommender.refresh(null);
    assertEquals(new GenericItem<String>("2"), firstRecommended.getItem());
    assertEquals(0.1, firstRecommended.getValue(), EPSILON);
  }

  public void testHowMany() throws Exception {
View Full Code Here

    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);
    for (int i = 0; i < fewRecommended.size(); i++) {
      assertEquals(fewRecommended.get(i).getItemID(), moreRecommended.get(i).getItemID());
    }
  }
View Full Code Here

    assertEquals(2, recommendCount.intValue());
    cachingRecommender.recommend(1, 1);
    assertEquals(2, recommendCount.intValue());
    cachingRecommender.recommend(2, 1);
    assertEquals(2, recommendCount.intValue());
    cachingRecommender.refresh(null);
    cachingRecommender.recommend(1, 1);
    assertEquals(3, recommendCount.intValue());
    cachingRecommender.recommend(2, 1);
    assertEquals(4, recommendCount.intValue());
    cachingRecommender.recommend(3, 1);
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.