Examples of itemSimilarities()


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

    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);
    assertEquals(0.5, valuesForOne[1], EPSILON);
  }
View Full Code Here

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

    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);
    assertEquals(0.5, valuesForOne[1], EPSILON);
  }
View Full Code Here

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

    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);
    assertEquals(0.5, valuesForOne[1], EPSILON);
  }
View Full Code Here

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

    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);
    assertEquals(0.5, valuesForOne[1], EPSILON);
  }
View Full Code Here

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

    EasyMock.expect(dataModel.getPreferencesFromUser(1L)).andReturn(preferencesFromUser);
    EasyMock.expect(candidateItemsStrategy.getCandidateItems(1L, preferencesFromUser, dataModel))
        .andReturn(new FastIDSet(new long[] { 3L, 4L }));

    EasyMock.expect(itemSimilarity.itemSimilarities(3L, preferencesFromUser.getIDs()))
        .andReturn(new double[] { 0.5, 0.3 });
    EasyMock.expect(itemSimilarity.itemSimilarities(4L, preferencesFromUser.getIDs()))
        .andReturn(new double[] { 0.4, 0.1 });

    EasyMock.replay(dataModel, itemSimilarity, candidateItemsStrategy, mostSimilarItemsCandidateItemsStrategy);
View Full Code Here

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

    EasyMock.expect(candidateItemsStrategy.getCandidateItems(1L, preferencesFromUser, dataModel))
        .andReturn(new FastIDSet(new long[] { 3L, 4L }));

    EasyMock.expect(itemSimilarity.itemSimilarities(3L, preferencesFromUser.getIDs()))
        .andReturn(new double[] { 0.5, 0.3 });
    EasyMock.expect(itemSimilarity.itemSimilarities(4L, preferencesFromUser.getIDs()))
        .andReturn(new double[] { 0.4, 0.1 });

    EasyMock.replay(dataModel, itemSimilarity, candidateItemsStrategy, mostSimilarItemsCandidateItemsStrategy);

    Recommender recommender = new GenericItemBasedRecommender(dataModel, itemSimilarity,
View Full Code Here

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

    EasyMock.expect(dataModel.getPreferencesFromUser(1L)).andReturn(preferencesFromUser);
    EasyMock.expect(candidateItemsStrategy.getCandidateItems(1L, preferencesFromUser, dataModel))
        .andReturn(new FastIDSet(new long[] { 3L, 4L }));

    EasyMock.expect(itemSimilarity.itemSimilarities(3L, preferencesFromUser.getIDs()))
        .andReturn(new double[] { 0.5, 0.3 });
    EasyMock.expect(itemSimilarity.itemSimilarities(4L, preferencesFromUser.getIDs()))
        .andReturn(new double[] { 0.4, 0.1 });

    EasyMock.replay(dataModel, itemSimilarity, candidateItemsStrategy, mostSimilarItemsCandidateItemsStrategy);
View Full Code Here

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

    EasyMock.expect(candidateItemsStrategy.getCandidateItems(1L, preferencesFromUser, dataModel))
        .andReturn(new FastIDSet(new long[] { 3L, 4L }));

    EasyMock.expect(itemSimilarity.itemSimilarities(3L, preferencesFromUser.getIDs()))
        .andReturn(new double[] { 0.5, 0.3 });
    EasyMock.expect(itemSimilarity.itemSimilarities(4L, preferencesFromUser.getIDs()))
        .andReturn(new double[] { 0.4, 0.1 });

    EasyMock.replay(dataModel, itemSimilarity, candidateItemsStrategy, mostSimilarItemsCandidateItemsStrategy);

    Recommender recommender = new GenericItemBasedRecommender(dataModel, itemSimilarity,
View Full Code Here

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

    EasyMock.expect(dataModel.getPreferencesFromUser(1L)).andReturn(preferencesFromUser);
    EasyMock.expect(candidateItemsStrategy.getCandidateItems(1L, preferencesFromUser, dataModel))
        .andReturn(new FastIDSet(new long[] { 3L, 4L }));

    EasyMock.expect(itemSimilarity.itemSimilarities(3L, preferencesFromUser.getIDs()))
        .andReturn(new double[] { 0.5, 0.3 });
    EasyMock.expect(itemSimilarity.itemSimilarities(4L, preferencesFromUser.getIDs()))
        .andReturn(new double[] { 0.4, 0.1 });

    EasyMock.replay(dataModel, itemSimilarity, candidateItemsStrategy, mostSimilarItemsCandidateItemsStrategy);
View Full Code Here

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

    EasyMock.expect(candidateItemsStrategy.getCandidateItems(1L, preferencesFromUser, dataModel))
        .andReturn(new FastIDSet(new long[] { 3L, 4L }));

    EasyMock.expect(itemSimilarity.itemSimilarities(3L, preferencesFromUser.getIDs()))
        .andReturn(new double[] { 0.5, 0.3 });
    EasyMock.expect(itemSimilarity.itemSimilarities(4L, preferencesFromUser.getIDs()))
        .andReturn(new double[] { 0.4, 0.1 });

    EasyMock.replay(dataModel, itemSimilarity, candidateItemsStrategy, mostSimilarItemsCandidateItemsStrategy);

    Recommender recommender = new GenericItemBasedRecommender(dataModel, itemSimilarity,
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.