Examples of PreferenceTransform


Examples of org.apache.mahout.cf.taste.transforms.PreferenceTransform

  }

  @Test
  public void testStdev() throws Exception {
    DataModel dataModel = getDataModel(new long[] {1}, new Double[][] {{-1.0,-2.0}});
    PreferenceTransform zScore = new ZScore(dataModel);
    assertEquals(Math.sqrt(2.0)/2.0, zScore.getTransformedValue(new GenericPreference(1, 0, -1.0f)), EPSILON);
    assertEquals(-Math.sqrt(2.0)/2.0, zScore.getTransformedValue(new GenericPreference(1, 1, -2.0f)), EPSILON);
  }
View Full Code Here

Examples of org.apache.mahout.cf.taste.transforms.PreferenceTransform

  }

  @Test
  public void testExample() throws Exception {
    DataModel dataModel = getDataModel(new long[] {1}, new Double[][] {{5.0, 7.0, 9.0}});
    PreferenceTransform zScore = new ZScore(dataModel);
    assertEquals(-1.0, zScore.getTransformedValue(new GenericPreference(1, 0, 5.0f)), EPSILON);
    assertEquals(0.0, zScore.getTransformedValue(new GenericPreference(1, 1, 7.0f)), EPSILON);
    assertEquals(1.0, zScore.getTransformedValue(new GenericPreference(1, 2, 9.0f)), 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.