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

Examples of org.apache.mahout.cf.taste.recommender.ItemBasedRecommender


    assertEquals(2, firstRecommended.getItemID());
    assertEquals(0.18, firstRecommended.getValue(), EPSILON);
  }

  public void testMostSimilar() throws Exception {
    ItemBasedRecommender recommender = buildRecommender();
    List<RecommendedItem> similar = recommender.mostSimilarItems(0, 2);
    assertNotNull(similar);
    assertEquals(2, similar.size());
    RecommendedItem first = similar.get(0);
    RecommendedItem second = similar.get(1);
    assertEquals(1, first.getItemID());
View Full Code Here


    assertEquals(2, second.getItemID());
    assertEquals(0.5, second.getValue(), EPSILON);
  }

  public void testMostSimilarToMultiple() throws Exception {
    ItemBasedRecommender recommender = buildRecommender2();
    List<RecommendedItem> similar = recommender.mostSimilarItems(new long[] {0, 1}, 2);
    assertNotNull(similar);
    assertEquals(2, similar.size());
    RecommendedItem first = similar.get(0);
    RecommendedItem second = similar.get(1);
    assertEquals(2, first.getItemID());
View Full Code Here

    assertEquals(3, second.getItemID());
    assertEquals(-0.3, second.getValue(), EPSILON);
  }

  public void testRecommendedBecause() throws Exception {
    ItemBasedRecommender recommender = buildRecommender2();
    List<RecommendedItem> recommendedBecause = recommender.recommendedBecause(1, 4, 3);
    assertNotNull(recommendedBecause);
    assertEquals(3, recommendedBecause.size());
    RecommendedItem first = recommendedBecause.get(0);
    RecommendedItem second = recommendedBecause.get(1);
    RecommendedItem third = recommendedBecause.get(2);
View Full Code Here

    assertEquals(0.1f, firstRecommended.getValue(), EPSILON);
  }

  @Test
  public void testMostSimilar() throws Exception {
    ItemBasedRecommender recommender = buildRecommender();
    List<RecommendedItem> similar = recommender.mostSimilarItems(0, 2);
    assertNotNull(similar);
    assertEquals(2, similar.size());
    RecommendedItem first = similar.get(0);
    RecommendedItem second = similar.get(1);
    assertEquals(1, first.getItemID());
View Full Code Here

    assertEquals(0.5f, second.getValue(), EPSILON);
  }

  @Test
  public void testMostSimilarToMultiple() throws Exception {
    ItemBasedRecommender recommender = buildRecommender2();
    List<RecommendedItem> similar = recommender.mostSimilarItems(new long[] {0, 1}, 2);
    assertNotNull(similar);
    assertEquals(2, similar.size());
    RecommendedItem first = similar.get(0);
    RecommendedItem second = similar.get(1);
    assertEquals(2, first.getItemID());
View Full Code Here

    assertEquals(-0.3f, second.getValue(), EPSILON);
  }

  @Test
  public void testRecommendedBecause() throws Exception {
    ItemBasedRecommender recommender = buildRecommender2();
    List<RecommendedItem> recommendedBecause = recommender.recommendedBecause(1, 4, 3);
    assertNotNull(recommendedBecause);
    assertEquals(3, recommendedBecause.size());
    RecommendedItem first = recommendedBecause.get(0);
    RecommendedItem second = recommendedBecause.get(1);
    RecommendedItem third = recommendedBecause.get(2);
View Full Code Here

    assertEquals(new GenericItem<String>("2"), firstRecommended.getItem());
    assertEquals(0.1, firstRecommended.getValue(), EPSILON);
  }

  public void testMostSimilar() throws Exception {
    ItemBasedRecommender recommender = buildRecommender();
    List<RecommendedItem> similar = recommender.mostSimilarItems("0", 2);
    assertNotNull(similar);
    assertEquals(2, similar.size());
    RecommendedItem first = similar.get(0);
    RecommendedItem second = similar.get(1);
    assertEquals("1", first.getItem().getID());
View Full Code Here

    assertEquals("2", second.getItem().getID());
    assertEquals(0.5, second.getValue(), EPSILON);
  }

  public void testMostSimilarToMultiple() throws Exception {
    ItemBasedRecommender recommender = buildRecommender2();
    List<Object> itemIDs = new ArrayList<Object>(2);
    itemIDs.add("0");
    itemIDs.add("1");
    List<RecommendedItem> similar = recommender.mostSimilarItems(itemIDs, 2);
    assertNotNull(similar);
    assertEquals(2, similar.size());
    RecommendedItem first = similar.get(0);
    RecommendedItem second = similar.get(1);
    assertEquals("2", first.getItem().getID());
View Full Code Here

    assertEquals("3", second.getItem().getID());
    assertEquals(-0.3, second.getValue(), EPSILON);
  }

  public void testRecommendedBecause() throws Exception {
    ItemBasedRecommender recommender = buildRecommender2();
    List<RecommendedItem> recommendedBecause = recommender.recommendedBecause("test1", "4", 3);
    assertNotNull(recommendedBecause);
    assertEquals(3, recommendedBecause.size());
    RecommendedItem first = recommendedBecause.get(0);
    RecommendedItem second = recommendedBecause.get(1);
    RecommendedItem third = recommendedBecause.get(2);
View Full Code Here

    assertEquals(0.1f, firstRecommended.getValue(), EPSILON);
  }

  @Test
  public void testMostSimilar() throws Exception {
    ItemBasedRecommender recommender = buildRecommender();
    List<RecommendedItem> similar = recommender.mostSimilarItems(0, 2);
    assertNotNull(similar);
    assertEquals(2, similar.size());
    RecommendedItem first = similar.get(0);
    RecommendedItem second = similar.get(1);
    assertEquals(1, first.getItemID());
View Full Code Here

TOP

Related Classes of org.apache.mahout.cf.taste.recommender.ItemBasedRecommender

Copyright © 2018 www.massapicom. 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.