Package org.apache.mahout.cf.taste.similarity

Examples of org.apache.mahout.cf.taste.similarity.ItemSimilarity.allSimilarItemIDs()


                      new GenericItemSimilarity.ItemItemSimilarity(3L, 5L, 0.2),
                      new GenericItemSimilarity.ItemItemSimilarity(3L, 4L, 0.2));

    ItemSimilarity similarity = new GenericItemSimilarity(itemItemSimilarities);

    assertTrue(containsExactly(similarity.allSimilarItemIDs(1L), 2L, 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(2L), 1L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(3L), 1L, 5L, 4L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(4L), 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(5L), 3L));
  }
View Full Code Here


                      new GenericItemSimilarity.ItemItemSimilarity(3L, 4L, 0.2));

    ItemSimilarity similarity = new GenericItemSimilarity(itemItemSimilarities);

    assertTrue(containsExactly(similarity.allSimilarItemIDs(1L), 2L, 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(2L), 1L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(3L), 1L, 5L, 4L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(4L), 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(5L), 3L));
  }
View Full Code Here

    ItemSimilarity similarity = new GenericItemSimilarity(itemItemSimilarities);

    assertTrue(containsExactly(similarity.allSimilarItemIDs(1L), 2L, 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(2L), 1L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(3L), 1L, 5L, 4L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(4L), 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(5L), 3L));
  }

  @Test
View Full Code Here

    ItemSimilarity similarity = new GenericItemSimilarity(itemItemSimilarities);

    assertTrue(containsExactly(similarity.allSimilarItemIDs(1L), 2L, 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(2L), 1L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(3L), 1L, 5L, 4L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(4L), 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(5L), 3L));
  }

  @Test
  public void testAllSimilaritiesWithIndex() throws TasteException {
View Full Code Here

    assertTrue(containsExactly(similarity.allSimilarItemIDs(1L), 2L, 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(2L), 1L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(3L), 1L, 5L, 4L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(4L), 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(5L), 3L));
  }

  @Test
  public void testAllSimilaritiesWithIndex() throws TasteException {
View Full Code Here

                      new GenericItemSimilarity.ItemItemSimilarity(3L, 5L, 0.2),
                      new GenericItemSimilarity.ItemItemSimilarity(3L, 4L, 0.2));

    ItemSimilarity similarity = new GenericItemSimilarity(itemItemSimilarities);

    assertTrue(containsExactly(similarity.allSimilarItemIDs(1L), 2L, 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(2L), 1L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(3L), 1L, 5L, 4L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(4L), 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(5L), 3L));
  }
View Full Code Here

                      new GenericItemSimilarity.ItemItemSimilarity(3L, 4L, 0.2));

    ItemSimilarity similarity = new GenericItemSimilarity(itemItemSimilarities);

    assertTrue(containsExactly(similarity.allSimilarItemIDs(1L), 2L, 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(2L), 1L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(3L), 1L, 5L, 4L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(4L), 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(5L), 3L));
  }
View Full Code Here

    ItemSimilarity similarity = new GenericItemSimilarity(itemItemSimilarities);

    assertTrue(containsExactly(similarity.allSimilarItemIDs(1L), 2L, 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(2L), 1L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(3L), 1L, 5L, 4L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(4L), 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(5L), 3L));
  }

  private static boolean containsExactly(long[] allIDs, long... shouldContainID) {
View Full Code Here

    ItemSimilarity similarity = new GenericItemSimilarity(itemItemSimilarities);

    assertTrue(containsExactly(similarity.allSimilarItemIDs(1L), 2L, 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(2L), 1L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(3L), 1L, 5L, 4L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(4L), 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(5L), 3L));
  }

  private static boolean containsExactly(long[] allIDs, long... shouldContainID) {
    return new FastIDSet(allIDs).intersectionSize(new FastIDSet(shouldContainID)) == shouldContainID.length;
View Full Code Here

    assertTrue(containsExactly(similarity.allSimilarItemIDs(1L), 2L, 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(2L), 1L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(3L), 1L, 5L, 4L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(4L), 3L));
    assertTrue(containsExactly(similarity.allSimilarItemIDs(5L), 3L));
  }

  private static boolean containsExactly(long[] allIDs, long... shouldContainID) {
    return new FastIDSet(allIDs).intersectionSize(new FastIDSet(shouldContainID)) == shouldContainID.length;
  }
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.