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

Examples of org.apache.mahout.cf.taste.impl.similarity.TanimotoCoefficientSimilarity


      RecommenderIRStatsEvaluator evaluator =
        new GenericRecommenderIRStatsEvaluator();
      RecommenderBuilder recommenderBuilder = new RecommenderBuilder() {
        @Override
        public Recommender buildRecommender(DataModel model) throws TasteException {
          UserSimilarity similarity = new TanimotoCoefficientSimilarity(model);
          UserNeighborhood neighborhood = new NearestNUserNeighborhood(2, similarity, model);
          return new GenericBooleanPrefUserBasedRecommender(model, neighborhood, similarity);
        }
      };
      IRStatistics stats = evaluator.evaluate(recommenderBuilder, null, model, null, 10, Double.NaN, 0.1);
View Full Code Here


    userData.put(2, new GenericUserPreferenceArray(Arrays.asList(new GenericPreference(2, 1, 1),
        new GenericPreference(2, 2, 1), new GenericPreference(2, 4, 1))));

    DataModel dataModel = new GenericDataModel(userData);
    ItemBasedRecommender recommender =
        new GenericItemBasedRecommender(dataModel, new TanimotoCoefficientSimilarity(dataModel));

    BatchItemSimilarities batchSimilarities = new MultithreadedBatchItemSimilarities(recommender, 10);

    batchSimilarities.computeItemSimilarities(1, 1, mock(SimilarItemsWriter.class));
  }
View Full Code Here

    userData.put(2, new GenericUserPreferenceArray(Arrays.asList(new GenericPreference(2, 1, 1),
        new GenericPreference(2, 2, 1), new GenericPreference(2, 4, 1))));

    DataModel dataModel = new GenericDataModel(userData);
    ItemBasedRecommender recommender =
        new GenericItemBasedRecommender(dataModel, new TanimotoCoefficientSimilarity(dataModel));

    BatchItemSimilarities batchSimilarities = new MultithreadedBatchItemSimilarities(recommender, 10);

    try {
      // Batch size is 100, so we only get 1 batch from 3 items, but we use a degreeOfParallelism of 2
View Full Code Here

    switch (params.itemSimilarity) {
      case MahoutAlgoParams.LOG_LIKELIHOOD:
        similarity = new LogLikelihoodSimilarity(dataModel);
        break;
      case MahoutAlgoParams.TANIMOTO_COEFFICIENT:
        similarity = new TanimotoCoefficientSimilarity(dataModel);
        break;
      default:
        logger.error("Invalid itemSimilarity: " + params.itemSimilarity +
          ". LogLikelihoodSimilarity is used.");
        similarity = new LogLikelihoodSimilarity(dataModel);
View Full Code Here

TOP

Related Classes of org.apache.mahout.cf.taste.impl.similarity.TanimotoCoefficientSimilarity

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.