Example usage for org.apache.mahout.cf.taste.impl.common RunningAverageAndStdDev getStandardDeviation

List of usage examples for org.apache.mahout.cf.taste.impl.common RunningAverageAndStdDev getStandardDeviation

Introduction

In this page you can find the example usage for org.apache.mahout.cf.taste.impl.common RunningAverageAndStdDev getStandardDeviation.

Prototype

double getStandardDeviation();

Source Link

Usage

From source file:recommender.GenericRecommenderIRStatsEvaluatorCustom.java

License:Apache License

private static double computeThreshold(PreferenceArray prefs) {
    if (prefs.length() < 2) {
        // Not enough data points -- return a threshold that allows everything
        return Double.NEGATIVE_INFINITY;
    }/*from   w  ww. ja v a2  s  .co  m*/
    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();
}