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

Examples of org.apache.mahout.cf.taste.similarity.PreferenceInferrer


/** <p>Tests {@link AveragingPreferenceInferrer}.</p> */
public final class AveragingPreferenceInferrerTest extends TasteTestCase {

  public void testInferrer() throws TasteException {
    DataModel model = getDataModel(new long[] {1}, new Double[][] {{3.0,-2.0,5.0}});
    PreferenceInferrer inferrer = new AveragingPreferenceInferrer(model);
    double inferred = inferrer.inferPreference(1, 3);
    assertEquals(2.0, inferred);
  }
View Full Code Here


  public void testInferrer() throws TasteException {
    User user1 = getUser("test1", 3.0, -2.0, 5.0);
    Item item = new GenericItem<String>("3");
    DataModel model = new GenericDataModel(Collections.singletonList(user1));
    PreferenceInferrer inferrer = new AveragingPreferenceInferrer(model);
    double inferred = inferrer.inferPreference(user1, item);
    assertEquals(2.0, inferred);
  }
View Full Code Here

      new Double[][] {
              {null, 1.0, 2.0,  null, null, 6.0},
              {1.0, 8.0, null, 3.04.0null},
      });
    UserSimilarity similarity = new PearsonCorrelationSimilarity(dataModel);
    similarity.setPreferenceInferrer(new PreferenceInferrer() {
      @Override
      public float inferPreference(long userID, long itemID) {
        return 1.0f;
      }
      @Override
View Full Code Here

public final class AveragingPreferenceInferrerTest extends TasteTestCase {

  @Test
  public void testInferrer() throws TasteException {
    DataModel model = getDataModel(new long[] {1}, new Double[][] {{3.0,-2.0,5.0}});
    PreferenceInferrer inferrer = new AveragingPreferenceInferrer(model);
    double inferred = inferrer.inferPreference(1, 3);
    assertEquals(2.0, inferred, EPSILON);
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.cf.taste.similarity.PreferenceInferrer

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.