Examples of itemSimilarity()


Examples of org.apache.mahout.cf.taste.impl.similarity.GenericItemSimilarity.itemSimilarity()

  @Test
  public void testFileItemItemSimilarityIterable() throws Exception {
    Iterable<ItemItemSimilarity> similarityIterable = new FileItemItemSimilarityIterable(testFile);
    GenericItemSimilarity similarity = new GenericItemSimilarity(similarityIterable);

    assertEquals(0.125, similarity.itemSimilarity(1L, 5L), EPSILON);
    assertEquals(0.125, similarity.itemSimilarity(5L, 1L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(1L, 7L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(7L, 1L), EPSILON);

    assertTrue(Double.isNaN(similarity.itemSimilarity(7L, 8L)));
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.similarity.GenericItemSimilarity.itemSimilarity()

  public void testFileItemItemSimilarityIterable() throws Exception {
    Iterable<ItemItemSimilarity> similarityIterable = new FileItemItemSimilarityIterable(testFile);
    GenericItemSimilarity similarity = new GenericItemSimilarity(similarityIterable);

    assertEquals(0.125, similarity.itemSimilarity(1L, 5L), EPSILON);
    assertEquals(0.125, similarity.itemSimilarity(5L, 1L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(1L, 7L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(7L, 1L), EPSILON);

    assertTrue(Double.isNaN(similarity.itemSimilarity(7L, 8L)));
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.similarity.GenericItemSimilarity.itemSimilarity()

    Iterable<ItemItemSimilarity> similarityIterable = new FileItemItemSimilarityIterable(testFile);
    GenericItemSimilarity similarity = new GenericItemSimilarity(similarityIterable);

    assertEquals(0.125, similarity.itemSimilarity(1L, 5L), EPSILON);
    assertEquals(0.125, similarity.itemSimilarity(5L, 1L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(1L, 7L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(7L, 1L), EPSILON);

    assertTrue(Double.isNaN(similarity.itemSimilarity(7L, 8L)));

    double[] valuesForOne = similarity.itemSimilarities(1L, new long[] { 5L, 7L });
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.similarity.GenericItemSimilarity.itemSimilarity()

    GenericItemSimilarity similarity = new GenericItemSimilarity(similarityIterable);

    assertEquals(0.125, similarity.itemSimilarity(1L, 5L), EPSILON);
    assertEquals(0.125, similarity.itemSimilarity(5L, 1L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(1L, 7L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(7L, 1L), EPSILON);

    assertTrue(Double.isNaN(similarity.itemSimilarity(7L, 8L)));

    double[] valuesForOne = similarity.itemSimilarities(1L, new long[] { 5L, 7L });
    assertNotNull(valuesForOne);
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.similarity.GenericItemSimilarity.itemSimilarity()

    assertEquals(0.125, similarity.itemSimilarity(1L, 5L), EPSILON);
    assertEquals(0.125, similarity.itemSimilarity(5L, 1L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(1L, 7L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(7L, 1L), EPSILON);

    assertTrue(Double.isNaN(similarity.itemSimilarity(7L, 8L)));

    double[] valuesForOne = similarity.itemSimilarities(1L, new long[] { 5L, 7L });
    assertNotNull(valuesForOne);
    assertEquals(2, valuesForOne.length);
    assertEquals(0.125, valuesForOne[0], EPSILON);
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.similarity.GenericItemSimilarity.itemSimilarity()

  @Test
  public void testFileItemItemSimilarityIterable() throws Exception {
    Iterable<ItemItemSimilarity> similarityIterable = new FileItemItemSimilarityIterable(testFile);
    GenericItemSimilarity similarity = new GenericItemSimilarity(similarityIterable);

    assertEquals(0.125, similarity.itemSimilarity(1L, 5L), EPSILON);
    assertEquals(0.125, similarity.itemSimilarity(5L, 1L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(1L, 7L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(7L, 1L), EPSILON);

    assertTrue(Double.isNaN(similarity.itemSimilarity(7L, 8L)));
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.similarity.GenericItemSimilarity.itemSimilarity()

  public void testFileItemItemSimilarityIterable() throws Exception {
    Iterable<ItemItemSimilarity> similarityIterable = new FileItemItemSimilarityIterable(testFile);
    GenericItemSimilarity similarity = new GenericItemSimilarity(similarityIterable);

    assertEquals(0.125, similarity.itemSimilarity(1L, 5L), EPSILON);
    assertEquals(0.125, similarity.itemSimilarity(5L, 1L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(1L, 7L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(7L, 1L), EPSILON);

    assertTrue(Double.isNaN(similarity.itemSimilarity(7L, 8L)));
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.similarity.GenericItemSimilarity.itemSimilarity()

    Iterable<ItemItemSimilarity> similarityIterable = new FileItemItemSimilarityIterable(testFile);
    GenericItemSimilarity similarity = new GenericItemSimilarity(similarityIterable);

    assertEquals(0.125, similarity.itemSimilarity(1L, 5L), EPSILON);
    assertEquals(0.125, similarity.itemSimilarity(5L, 1L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(1L, 7L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(7L, 1L), EPSILON);

    assertTrue(Double.isNaN(similarity.itemSimilarity(7L, 8L)));

    double[] valuesForOne = similarity.itemSimilarities(1L, new long[] { 5L, 7L });
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.similarity.GenericItemSimilarity.itemSimilarity()

    GenericItemSimilarity similarity = new GenericItemSimilarity(similarityIterable);

    assertEquals(0.125, similarity.itemSimilarity(1L, 5L), EPSILON);
    assertEquals(0.125, similarity.itemSimilarity(5L, 1L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(1L, 7L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(7L, 1L), EPSILON);

    assertTrue(Double.isNaN(similarity.itemSimilarity(7L, 8L)));

    double[] valuesForOne = similarity.itemSimilarities(1L, new long[] { 5L, 7L });
    assertNotNull(valuesForOne);
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.similarity.GenericItemSimilarity.itemSimilarity()

    assertEquals(0.125, similarity.itemSimilarity(1L, 5L), EPSILON);
    assertEquals(0.125, similarity.itemSimilarity(5L, 1L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(1L, 7L), EPSILON);
    assertEquals(0.5, similarity.itemSimilarity(7L, 1L), EPSILON);

    assertTrue(Double.isNaN(similarity.itemSimilarity(7L, 8L)));

    double[] valuesForOne = similarity.itemSimilarities(1L, new long[] { 5L, 7L });
    assertNotNull(valuesForOne);
    assertEquals(2, valuesForOne.length);
    assertEquals(0.125, valuesForOne[0], EPSILON);
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.