Search in sources :

Example 21 with StandardDeviation

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);
}
Also used : StandardDeviation(org.apache.commons.math3.stat.descriptive.moment.StandardDeviation)

Example 22 with StandardDeviation

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);
}
Also used : StandardDeviation(org.apache.commons.math3.stat.descriptive.moment.StandardDeviation)

Example 23 with StandardDeviation

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);
        }
    };
}
Also used : Mean(org.apache.commons.math3.stat.descriptive.moment.Mean) StandardDeviation(org.apache.commons.math3.stat.descriptive.moment.StandardDeviation)

Aggregations

StandardDeviation (org.apache.commons.math3.stat.descriptive.moment.StandardDeviation)20 Mean (org.apache.commons.math3.stat.descriptive.moment.Mean)11 Test (org.testng.annotations.Test)9 Collectors (java.util.stream.Collectors)4 NormalDistribution (org.apache.commons.math3.distribution.NormalDistribution)4 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)4 List (java.util.List)3 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 IntStream (java.util.stream.IntStream)2 RealMatrix (org.apache.commons.math3.linear.RealMatrix)2 BrentOptimizer (org.apache.commons.math3.optim.univariate.BrentOptimizer)2 SearchInterval (org.apache.commons.math3.optim.univariate.SearchInterval)2 UnivariateObjectiveFunction (org.apache.commons.math3.optim.univariate.UnivariateObjectiveFunction)2 Median (org.apache.commons.math3.stat.descriptive.rank.Median)2 LogManager (org.apache.logging.log4j.LogManager)2 Logger (org.apache.logging.log4j.Logger)2 KernelDensity (org.apache.spark.mllib.stat.KernelDensity)2 Utils (org.broadinstitute.hellbender.utils.Utils)2 StandardFormat (de.bioforscher.jstructure.StandardFormat)1