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

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


        new EuclideanDistanceSimilarity(dataModel).itemSimilarity(0, 1);
    assertCorrelationEquals(0.5896248568217328, correlation);
  }

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


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

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

    double correlation = new SpearmanCorrelationSimilarity(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},
                    {4.0, 5.0, 6.0},
            });
View Full Code Here

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

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

    assertEquals(2, firstRecommended.getItemID());
    assertEquals(0.34803885284992736, firstRecommended.getValue(), EPSILON);
  }

  public void testHowMany() throws Exception {
    DataModel dataModel = getDataModel(
            new long[] {1, 2, 3, 4, 5},
            new Double[][] {
                    {0.1, 0.2},
                    {0.2, 0.3, 0.3, 0.6},
                    {0.4, 0.4, 0.5, 0.9},
View Full Code Here

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

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

      assertEquals(fewRecommended.get(i).getItemID(), moreRecommended.get(i).getItemID());
    }
  }

  public void testRescorer() throws Exception {
    DataModel dataModel = getDataModel(
            new long[] {1, 2, 3},
            new Double[][] {
                    {0.1, 0.2},
                    {0.2, 0.3, 0.3, 0.6},
                    {0.4, 0.4, 0.5, 0.9},
View Full Code Here

    Recommender recommender = buildRecommender();
    assertEquals(0.34803885284992736, recommender.estimatePreference(1, 2), EPSILON);
  }

  public void testBestRating() throws Exception {
    DataModel dataModel = getDataModel(
            new long[] {1, 2, 3},
            new Double[][] {
                    {0.0, 0.3},
                    {0.2, 0.3, 0.3},
                    {0.4, 0.3, 0.5},
View Full Code Here

    assertEquals(2, firstRecommended.getItemID());
    assertEquals(0.2400938676203033, firstRecommended.getValue(), EPSILON);
  }

  public void testDiffStdevBehavior() throws Exception {
    DataModel dataModel = getDataModel(
            new long[] {1, 2, 3},
            new Double[][] {
                    {0.1, 0.2},
                    {0.2, 0.3, 0.6},
                    {0.3, 0.3, 0.3},
View Full Code Here

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

  public void testNoRecommendations() throws Exception {
    DataModel dataModel = getDataModel(
            new long[] {1, 2, 3},
            new Double[][] {
                    {0.1},
                    {0.2, 0.6},
                    {0.4, 0.9},
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.