use of org.apache.commons.math3.stat.descriptive.moment.StandardDeviation in project presto by prestodb.
the class TestDoubleStdDevAggregation method getExpectedValue.
@Override
public Number getExpectedValue(int start, int length) {
if (length < 2) {
return null;
}
double[] values = new double[length];
for (int i = 0; i < length; i++) {
values[i] = start + i;
}
StandardDeviation stdDev = new StandardDeviation();
return stdDev.evaluate(values);
}
use of org.apache.commons.math3.stat.descriptive.moment.StandardDeviation in project presto by prestodb.
the class TestLongStdDevPopAggregation method getExpectedValue.
@Override
public Number getExpectedValue(int start, int length) {
if (length == 0) {
return null;
}
double[] values = new double[length];
for (int i = 0; i < length; i++) {
values[i] = start + i;
}
StandardDeviation stdDev = new StandardDeviation(false);
return stdDev.evaluate(values);
}
use of org.apache.commons.math3.stat.descriptive.moment.StandardDeviation in project recordinality by cscotta.
the class RecordinalityTest method buildRun.
private Callable<Result> buildRun(final int kSize, final int numRuns, final List<String> lines) {
return new Callable<Result>() {
public Result call() throws Exception {
long start = System.currentTimeMillis();
final double[] results = new double[numRuns];
for (int i = 0; i < numRuns; i++) {
Recordinality rec = new Recordinality(kSize);
for (String line : lines) rec.observe(line);
results[i] = rec.estimateCardinality();
}
double mean = new Mean().evaluate(results);
double stdDev = new StandardDeviation().evaluate(results);
double stdError = stdDev / 3193;
long runTime = System.currentTimeMillis() - start;
return new Result(kSize, mean, stdError, runTime);
}
};
}
Aggregations