Examples of IRStatistics


Examples of org.apache.mahout.cf.taste.eval.IRStatistics

          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);
      System.out.println(stats);
  }
View Full Code Here

Examples of org.apache.mahout.cf.taste.eval.IRStatistics

          new NearestNUserNeighborhood(2, similarity, model);
        return new GenericUserBasedRecommender(model, neighborhood, similarity);
      }
    };
    // Evaluate precision and recall "at 2":
    IRStatistics stats = evaluator.evaluate(recommenderBuilder,
                                            null, model, null, 2,
                                            GenericRecommenderIRStatsEvaluator.CHOOSE_THRESHOLD,
                                            1.0);
    System.out.println(stats.getPrecision());
    System.out.println(stats.getRecall());
  }
View Full Code Here

Examples of org.apache.mahout.cf.taste.eval.IRStatistics

      public DataModel buildDataModel(FastByIDMap<PreferenceArray> trainingData) {
        return new GenericBooleanPrefDataModel(
          GenericBooleanPrefDataModel.toDataMap(trainingData));
      }
    };
    IRStatistics stats = evaluator.evaluate(
        recommenderBuilder, modelBuilder, model, null, 10,
        GenericRecommenderIRStatsEvaluator.CHOOSE_THRESHOLD,
        1.0);
    System.out.println(stats.getPrecision());
    System.out.println(stats.getRecall());
  }
View Full Code Here

Examples of org.apache.mahout.cf.taste.eval.IRStatistics

      public Recommender buildRecommender(DataModel dataModel) throws TasteException {
        return new SlopeOneRecommender(dataModel);
      }
    };
    RecommenderIRStatsEvaluator evaluator = new GenericRecommenderIRStatsEvaluator();
    IRStatistics stats = evaluator.evaluate(builder, null, model, null, 1, 0.2, 1.0);
    assertNotNull(stats);
    assertEquals(0.75, stats.getPrecision(), EPSILON);
    assertEquals(0.75, stats.getRecall(), EPSILON);
    assertEquals(0.75, stats.getF1Measure(), EPSILON);
  }
View Full Code Here

Examples of org.apache.mahout.cf.taste.eval.IRStatistics

      model = new BookCrossingDataModel(ratingsFile, true);
    } else {
      model = new BookCrossingDataModel(true);
    }

    IRStatistics evaluation = evaluator.evaluate(
        new BookCrossingBooleanRecommenderBuilder(),
        new BookCrossingDataModelBuilder(),
        model,
        null,
        3,
View Full Code Here

Examples of org.apache.mahout.cf.taste.eval.IRStatistics

      public Recommender buildRecommender(DataModel dataModel) throws TasteException {
        return new SlopeOneRecommender(dataModel);
      }
    };
    RecommenderIRStatsEvaluator evaluator = new GenericRecommenderIRStatsEvaluator();
    IRStatistics stats = evaluator.evaluate(builder, null, model, null, 1, 0.2, 1.0);
    assertNotNull(stats);
    assertEquals(0.75, stats.getPrecision(), EPSILON);
    assertEquals(0.75, stats.getRecall(), EPSILON);
    assertEquals(0.75, stats.getF1Measure(), EPSILON);
  }
View Full Code Here

Examples of org.apache.mahout.cf.taste.eval.IRStatistics

      public Recommender buildRecommender(DataModel dataModel) throws TasteException {
        return new SlopeOneRecommender(dataModel);
      }
    };
    RecommenderIRStatsEvaluator evaluator = new GenericRecommenderIRStatsEvaluator();
    IRStatistics stats = evaluator.evaluate(builder, model, null, 5, 0.2, 1.0);
    assertNotNull(stats);
    assertEquals(0.5, stats.getPrecision(), EPSILON);
    assertEquals(1.0, stats.getRecall(), EPSILON);
    assertEquals(0.6666666666666666, stats.getF1Measure(), EPSILON);
  }
View Full Code Here

Examples of org.apache.mahout.cf.taste.eval.IRStatistics

    RecommenderIRStatsEvaluator evaluator = new GenericRecommenderIRStatsEvaluator();
    File ratingsFile = TasteOptionParser.getRatings(args);
    DataModel model =
        ratingsFile == null ? new BookCrossingDataModel(true) : new BookCrossingDataModel(ratingsFile, true);

    IRStatistics evaluation = evaluator.evaluate(
        new BookCrossingBooleanRecommenderBuilder(),
        new BookCrossingDataModelBuilder(),
        model,
        null,
        3,
View Full Code Here

Examples of org.apache.mahout.cf.taste.eval.IRStatistics

      public Recommender buildRecommender(DataModel dataModel) throws TasteException {
        return new SlopeOneRecommender(dataModel);
      }
    };
    RecommenderIRStatsEvaluator evaluator = new GenericRecommenderIRStatsEvaluator();
    IRStatistics stats = evaluator.evaluate(builder, null, model, null, 1, 0.2, 1.0);
    assertNotNull(stats);
    assertEquals(0.75, stats.getPrecision(), EPSILON);
    assertEquals(0.75, stats.getRecall(), EPSILON);
    assertEquals(0.75, stats.getF1Measure(), EPSILON);
    assertEquals(0.75, stats.getFNMeasure(2.0), EPSILON);
    assertEquals(0.75, stats.getNormalizedDiscountedCumulativeGain(), EPSILON);
  }
View Full Code Here

Examples of org.apache.mahout.cf.taste.eval.IRStatistics

      public DataModel buildDataModel(FastByIDMap<PreferenceArray> trainingData) {
        return new GenericBooleanPrefDataModel(GenericBooleanPrefDataModel.toDataMap(trainingData));
      }
    };
    RecommenderIRStatsEvaluator evaluator = new GenericRecommenderIRStatsEvaluator();
    IRStatistics stats = evaluator.evaluate(
        builder, dataModelBuilder, model, null, 1, GenericRecommenderIRStatsEvaluator.CHOOSE_THRESHOLD, 1.0);

    assertNotNull(stats);
    assertEquals(0.666666666, stats.getPrecision(), EPSILON);
    assertEquals(0.666666666, stats.getRecall(), EPSILON);
    assertEquals(0.666666666, stats.getF1Measure(), EPSILON);
    assertEquals(0.666666666, stats.getFNMeasure(2.0), EPSILON);
    assertEquals(0.666666666, stats.getNormalizedDiscountedCumulativeGain(), 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.