Examples of RunningAverageAndStdDev


Examples of org.apache.mahout.cf.taste.impl.common.RunningAverageAndStdDev

 
  private class MeanStdevRetriever implements Retriever<Long,RunningAverageAndStdDev> {
   
    @Override
    public RunningAverageAndStdDev get(Long userID) throws TasteException {
      RunningAverageAndStdDev running = new FullRunningAverageAndStdDev();
      PreferenceArray prefs = dataModel.getPreferencesFromUser(userID);
      int size = prefs.length();
      for (int i = 0; i < size; i++) {
        running.addDatum(prefs.getValue(i));
      }
      return running;
    }
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.common.RunningAverageAndStdDev

      long userID = validationPrefs.get(0).getUserID();
      estimateCallables.add(
          new PreferenceEstimateCallable(recommender, userID, validationPrefs, noEstimateCounter));
    }

    RunningAverageAndStdDev timing = new FullRunningAverageAndStdDev();
    execute(estimateCallables, noEstimateCounter, timing);

    double result = computeFinalEvaluation();
    log.info("Evaluation result: {}", result);
    return result;
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.common.RunningAverageAndStdDev

  public void testRemovePref() throws Exception {
    double eps = 0.0001;
    DataModel model = getDataModelPocked();
    MemoryDiffStorage storage = new MemoryDiffStorage(model, Weighting.WEIGHTED, Long.MAX_VALUE);
   
    RunningAverageAndStdDev average = (RunningAverageAndStdDev) storage.getDiff(0, 1);
    assertEquals(-0.033333, average.getAverage(), eps);
    assertEquals(0.32145, average.getStandardDeviation(), eps);
    assertEquals(3, average.getCount());

    storage.removeItemPref(2, 1, 0.1f);
    average = (RunningAverageAndStdDev) storage.getDiff(0, 1);
    assertEquals(0.00000001, average.getAverage(), eps);
    assertEquals(0.44721, average.getStandardDeviation(), eps);
    assertEquals(2, average.getCount());
  }
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.common.RunningAverageAndStdDev

    returnString.append(confusionMatrix);
    returnString.append("=======================================================\n");
    returnString.append("Statistics\n");
    returnString.append("-------------------------------------------------------\n");
   
    RunningAverageAndStdDev normStats = confusionMatrix.getNormalizedStats();
    returnString.append(StringUtils.rightPad("Kappa", 40)).append(
      StringUtils.leftPad(decimalFormatter.format(confusionMatrix.getKappa()), 10)).append('\n');
    returnString.append(StringUtils.rightPad("Accuracy", 40)).append(
      StringUtils.leftPad(decimalFormatter.format(confusionMatrix.getAccuracy()), 10)).append("%\n");
    returnString.append(StringUtils.rightPad("Reliability", 40)).append(
      StringUtils.leftPad(decimalFormatter.format(normStats.getAverage() * 100.00000001), 10)).append("%\n");
    returnString.append(StringUtils.rightPad("Reliability (standard deviation)", 40)).append(
      StringUtils.leftPad(decimalFormatter.format(normStats.getStandardDeviation()), 10)).append('\n');
    returnString.append(StringUtils.rightPad("Weighted precision", 40)).append(
      StringUtils.leftPad(decimalFormatter.format(confusionMatrix.getWeightedPrecision()), 10)).append('\n');
    returnString.append(StringUtils.rightPad("Weighted recall", 40)).append(
      StringUtils.leftPad(decimalFormatter.format(confusionMatrix.getWeightedRecall()), 10)).append('\n');
    returnString.append(StringUtils.rightPad("Weighted F1 score", 40)).append(
View Full Code Here

Examples of org.apache.mahout.cf.taste.impl.common.RunningAverageAndStdDev

   * Standard deviation of normalized producer accuracy
   * Not a standard score
   * @return double
   */
  public RunningAverageAndStdDev getNormalizedStats() {
    RunningAverageAndStdDev summer = new FullRunningAverageAndStdDev();
    for (int d = 0; d < confusionMatrix.length; d++) {
      double total = 0;
      for (int j = 0; j < confusionMatrix.length; j++) {
        total += confusionMatrix[d][j];
      }
      summer.addDatum(confusionMatrix[d][d] / (total + 0.000001));
    }
   
    return summer;
  }
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.