Package org.apache.mahout.cf.taste.recommender

Examples of org.apache.mahout.cf.taste.recommender.UserBasedRecommender


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

  public void testMostSimilar() throws Exception {
    UserBasedRecommender recommender = buildRecommender();
    long[] similar = recommender.mostSimilarUserIDs(1, 2);
    assertNotNull(similar);
    assertEquals(2, similar.length);
    assertEquals(2, similar[0]);
    assertEquals(4, similar[1]);
  }
View Full Code Here


                    {0.4, 0.4, 0.5, 0.9},
                    {null, null, null, null, 1.0},
            });
    UserSimilarity similarity = new PearsonCorrelationSimilarity(dataModel);
    UserNeighborhood neighborhood = new NearestNUserNeighborhood(3, similarity, dataModel);
    UserBasedRecommender recommender = new GenericUserBasedRecommender(dataModel, neighborhood, similarity);
    long[] mostSimilar = recommender.mostSimilarUserIDs(4, 3);
    assertNotNull(mostSimilar);
    assertEquals(0, mostSimilar.length);
  }
View Full Code Here

    assertEquals(0.1f, firstRecommended.getValue(), EPSILON);
  }

  @Test
  public void testMostSimilar() throws Exception {
    UserBasedRecommender recommender = buildRecommender();
    long[] similar = recommender.mostSimilarUserIDs(1, 2);
    assertNotNull(similar);
    assertEquals(2, similar.length);
    assertEquals(2, similar[0]);
    assertEquals(4, similar[1]);
  }
View Full Code Here

                    {0.4, 0.4, 0.5, 0.9},
                    {null, null, null, null, 1.0},
            });
    UserSimilarity similarity = new PearsonCorrelationSimilarity(dataModel);
    UserNeighborhood neighborhood = new NearestNUserNeighborhood(3, similarity, dataModel);
    UserBasedRecommender recommender = new GenericUserBasedRecommender(dataModel, neighborhood, similarity);
    long[] mostSimilar = recommender.mostSimilarUserIDs(4, 3);
    assertNotNull(mostSimilar);
    assertEquals(0, mostSimilar.length);
  }
View Full Code Here

    assertEquals(new GenericItem<String>("2"), firstRecommended.getItem());
    assertEquals(0.3, firstRecommended.getValue(), EPSILON);
  }

  public void testMostSimilar() throws Exception {
    UserBasedRecommender recommender = buildRecommender();
    List<User> similar = recommender.mostSimilarUsers("test1", 2);
    assertNotNull(similar);
    assertEquals(2, similar.size());
    User first = similar.get(0);
    User second = similar.get(1);
    assertEquals("test2", first.getID());
View Full Code Here

    users.add(getUser("test3", 0.4, 0.4, 0.5, 0.9));
    users.add(getUser("test4"));
    DataModel dataModel = new GenericDataModel(users);
    UserSimilarity similarity = new PearsonCorrelationSimilarity(dataModel);
    UserNeighborhood neighborhood = new NearestNUserNeighborhood(3, similarity, dataModel);
    UserBasedRecommender recommender = new GenericUserBasedRecommender(dataModel, neighborhood, similarity);
    Collection<User> mostSimilar = recommender.mostSimilarUsers("test4", 3);
    assertNotNull(mostSimilar);
    assertEquals(0, mostSimilar.size());
  }
View Full Code Here

    assertEquals(0.1f, firstRecommended.getValue(), EPSILON);
  }

  @Test
  public void testMostSimilar() throws Exception {
    UserBasedRecommender recommender = buildRecommender();
    long[] similar = recommender.mostSimilarUserIDs(1, 2);
    assertNotNull(similar);
    assertEquals(2, similar.length);
    assertEquals(2, similar[0]);
    assertEquals(3, similar[1]);
  }
View Full Code Here

                    {0.4, 0.4, 0.5, 0.9},
                    {null, null, null, null, 1.0},
            });
    UserSimilarity similarity = new PearsonCorrelationSimilarity(dataModel);
    UserNeighborhood neighborhood = new NearestNUserNeighborhood(3, similarity, dataModel);
    UserBasedRecommender recommender = new GenericUserBasedRecommender(dataModel, neighborhood, similarity);
    long[] mostSimilar = recommender.mostSimilarUserIDs(4, 3);
    assertNotNull(mostSimilar);
    assertEquals(0, mostSimilar.length);
  }
View Full Code Here

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

  public void testMostSimilar() throws Exception {
    UserBasedRecommender recommender = buildRecommender();
    long[] similar = recommender.mostSimilarUserIDs(1, 2);
    assertNotNull(similar);
    assertEquals(2, similar.length);
    assertEquals(2, similar[0]);
    assertEquals(4, similar[1]);
  }
View Full Code Here

                    {0.4, 0.4, 0.5, 0.9},
                    {null, null, null, null, 1.0},
            });
    UserSimilarity similarity = new PearsonCorrelationSimilarity(dataModel);
    UserNeighborhood neighborhood = new NearestNUserNeighborhood(3, similarity, dataModel);
    UserBasedRecommender recommender = new GenericUserBasedRecommender(dataModel, neighborhood, similarity);
    long[] mostSimilar = recommender.mostSimilarUserIDs(4, 3);
    assertNotNull(mostSimilar);
    assertEquals(0, mostSimilar.length);
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.cf.taste.recommender.UserBasedRecommender

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.