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

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


 
  private static Collection<Callable<Void>> wrapWithStatsCallables(Collection<Callable<Void>> callables) {
    int size = callables.size();
    Collection<Callable<Void>> wrapped = new ArrayList<Callable<Void>>(size);
    int count = 0;
    RunningAverageAndStdDev timing = new FullRunningAverageAndStdDev();
    for (Callable<Void> callable : callables) {
      boolean logStats = count++ % 1000 == 0; // log every 100 or so iterations
      wrapped.add(new StatsCallable(callable, logStats, timing));
    }
    return wrapped;
View Full Code Here


  private static double computeThreshold(PreferenceArray prefs) {
    if (prefs.length() < 2) {
      // Not enough data points -- return a threshold that allows everything
      return Double.NEGATIVE_INFINITY;
    }
    RunningAverageAndStdDev stdDev = new FullRunningAverageAndStdDev();
    int size = prefs.length();
    for (int i = 0; i < size; i++) {
      stdDev.addDatum(prefs.getValue(i));
    }
    return stdDev.getAverage() + stdDev.getStandardDeviation();
  }
View Full Code Here

    return averageCount;
  }
 
  private RunningAverage buildRunningAverage() {
    if (stdDevWeighted) {
      return compactAverages ? new CompactRunningAverageAndStdDev() : new FullRunningAverageAndStdDev();
    } else {
      return compactAverages ? new CompactRunningAverage() : new FullRunningAverage();
    }
  }
View Full Code Here

 
  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

  private static double computeThreshold(PreferenceArray prefs) {
    if (prefs.length() < 2) {
      // Not enough data points -- return a threshold that allows everything
      return Double.NEGATIVE_INFINITY;
    }
    RunningAverageAndStdDev stdDev = new FullRunningAverageAndStdDev();
    int size = prefs.length();
    for (int i = 0; i < size; i++) {
      stdDev.addDatum(prefs.getValue(i));
    }
    return stdDev.getAverage() + stdDev.getStandardDeviation();
  }
View Full Code Here

    return averageCount;
  }
 
  private RunningAverage buildRunningAverage() {
    if (stdDevWeighted) {
      return compactAverages ? new CompactRunningAverageAndStdDev() : new FullRunningAverageAndStdDev();
    } else {
      return compactAverages ? new CompactRunningAverage() : new FullRunningAverage();
    }
  }
View Full Code Here

  private static Collection<Callable<Void>> wrapWithStatsCallables(Collection<Callable<Void>> callables,
                                                                   AtomicInteger noEstimateCounter) {
    int size = callables.size();
    Collection<Callable<Void>> wrapped = new ArrayList<Callable<Void>>(size);
    int count = 0;
    RunningAverageAndStdDev timing = new FullRunningAverageAndStdDev();
    for (Callable<Void> callable : callables) {
      boolean logStats = count++ % 1000 == 0; // log every 100 or so iterations
      wrapped.add(new StatsCallable(callable, logStats, timing, noEstimateCounter));
    }
    return wrapped;
View Full Code Here

  private static class MeanStdevRetriever implements Retriever<User, RunningAverageAndStdDev> {

    @Override
    public RunningAverageAndStdDev get(User user) throws TasteException {
      RunningAverageAndStdDev running = new FullRunningAverageAndStdDev();
      Preference[] prefs = user.getPreferencesAsArray();
      for (Preference pref : prefs) {
        running.addDatum(pref.getValue());
      }
      return running;
    }
View Full Code Here

    return averageCount;
  }

  private RunningAverage buildRunningAverage() {
    if (stdDevWeighted) {
      return compactAverages ? new CompactRunningAverageAndStdDev() : new FullRunningAverageAndStdDev();
    } else {
      return compactAverages ? new CompactRunningAverage() : new FullRunningAverage();
    }
  }
View Full Code Here

  private static double computeThreshold(Preference[] prefs) {
    if (prefs.length < 2) {
      // Not enough data points -- return a threshold that allows everything
      return Double.NEGATIVE_INFINITY;
    }
    RunningAverageAndStdDev stdDev = new FullRunningAverageAndStdDev();
    for (Preference pref : prefs) {
      stdDev.addDatum(pref.getValue());
    }
    return stdDev.getAverage() + stdDev.getStandardDeviation();
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.cf.taste.impl.common.FullRunningAverageAndStdDev

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.