Package org.apache.mahout.cf.taste.model

Examples of org.apache.mahout.cf.taste.model.DataModel


    double correlation = new TanimotoCoefficientSimilarity(dataModel).userSimilarity(1, 2);
    assertCorrelationEquals(Double.NaN, correlation);
  }

  public void testFullCorrelation1() throws Exception {
    DataModel dataModel = getDataModel(
            new long[] {1, 2},
            new Double[][] {
                    {1.0},
                    {1.0},
            });
View Full Code Here


    double correlation = new TanimotoCoefficientSimilarity(dataModel).userSimilarity(1, 2);
    assertCorrelationEquals(1.0, correlation);
  }

  public void testFullCorrelation2() throws Exception {
    DataModel dataModel = getDataModel(
            new long[] {1, 2},
            new Double[][] {
                    {1.0, 2.0, 3.0},
                    {1.0},
            });
View Full Code Here

    double correlation = new TanimotoCoefficientSimilarity(dataModel).userSimilarity(1, 2);
    assertCorrelationEquals(0.3333333333333333, correlation);
  }

  public void testCorrelation1() throws Exception {
    DataModel dataModel = getDataModel(
            new long[] {1, 2},
            new Double[][] {
                    {null, 2.0, 3.0},
                    {1.0, 1.0},
            });
View Full Code Here

    double correlation = new TanimotoCoefficientSimilarity(dataModel).userSimilarity(1, 2);
    assertEquals(0.3333333333333333, correlation);
  }

  public void testCorrelation2() throws Exception {
    DataModel dataModel = getDataModel(
            new long[] {1, 2},
            new Double[][] {
                    {null, 2.0, 3.0, 1.0},
                    {1.0, 1.0, null, 0.0},
            });
View Full Code Here

    super.setUp();
    random = RandomUtils.getRandom();
  }

  public void testSlopeOneLoad() throws Exception {
    DataModel model = createModel();
    Recommender recommender = new CachingRecommender(new SlopeOneRecommender(model));
    doTestLoad(recommender, 60);
  }
View Full Code Here

    Recommender recommender = new CachingRecommender(new SlopeOneRecommender(model));
    doTestLoad(recommender, 60);
  }

  public void testItemLoad() throws Exception {
    DataModel model = createModel();
    ItemSimilarity itemSimilarity = new PearsonCorrelationSimilarity(model);
    Recommender recommender = new CachingRecommender(new GenericItemBasedRecommender(model, itemSimilarity));
    doTestLoad(recommender, 240);
  }
View Full Code Here

    Recommender recommender = new CachingRecommender(new GenericItemBasedRecommender(model, itemSimilarity));
    doTestLoad(recommender, 240);
  }

  public void testUserLoad() throws Exception {
    DataModel model = createModel();
    UserSimilarity userSimilarity = new PearsonCorrelationSimilarity(model);
    UserNeighborhood neighborhood = new NearestNUserNeighborhood(10, userSimilarity, model);
    Recommender recommender =
        new CachingRecommender(new GenericUserBasedRecommender(model, neighborhood, userSimilarity));
    doTestLoad(recommender, 40);
View Full Code Here

/** <p>Tests {@link ZScore}.</p> */
public final class ZScoreTest extends TransformTestCase {

  public void testOnePref() throws Exception {
    DataModel dataModel = getDataModel(new long[] {1}, new Double[][] {{1.0}});
    PreferenceTransform zScore = new ZScore(dataModel);
    assertEquals(0.0, zScore.getTransformedValue(new GenericPreference(1, 0, 1.0f)), EPSILON);
  }
View Full Code Here

/** <p>Tests {@link PearsonCorrelationSimilarity}.</p> */
public final class PearsonCorrelationSimilarityTest extends SimilarityTestCase {

  public void testFullCorrelation1() throws Exception {
    DataModel dataModel = getDataModel(
            new long[] {1, 2},
            new Double[][] {
                    {3.0, -2.0},
                    {3.0, -2.0},
            });
View Full Code Here

    double correlation = new PearsonCorrelationSimilarity(dataModel).userSimilarity(1, 2);
    assertCorrelationEquals(1.0, correlation);
  }

  public void testFullCorrelation1Weighted() throws Exception {
    DataModel dataModel = getDataModel(
            new long[] {1, 2},
            new Double[][] {
                    {3.0, -2.0},
                    {3.0, -2.0},
            });
View Full Code Here

TOP

Related Classes of org.apache.mahout.cf.taste.model.DataModel

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.