Example usage for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getMax

List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getMax

Introduction

In this page you can find the example usage for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getMax.

Prototype

public double getMax() 

Source Link

Document

Returns the maximum of the available values

Usage

From source file:com.teradata.benchto.service.model.AggregatedMeasurement.java

public static AggregatedMeasurement aggregate(MeasurementUnit unit, Collection<Double> values) {
    if (values.size() < 2) {
        Double value = Iterables.getOnlyElement(values);
        return new AggregatedMeasurement(unit, value, value, value, 0.0, 0.0);
    }//from w  w  w . j  ava  2 s  . c om
    DescriptiveStatistics statistics = new DescriptiveStatistics(
            values.stream().mapToDouble(Double::doubleValue).toArray());

    double stdDevPercent = 0.0;
    if (statistics.getStandardDeviation() > 0.0) {
        stdDevPercent = (statistics.getStandardDeviation() / statistics.getMean()) * 100;
    }

    return new AggregatedMeasurement(unit, statistics.getMin(), statistics.getMax(), statistics.getMean(),
            statistics.getStandardDeviation(), stdDevPercent);
}

From source file:com.intuit.tank.vm.common.util.ReportUtil.java

public static final String[] getSummaryData(String key, DescriptiveStatistics stats) {
    String[] ret = new String[ReportUtil.SUMMARY_HEADERS.length + PERCENTILES.length];
    int i = 0;//from  w ww .  jav  a 2 s  .c  om
    ret[i++] = key;// Page ID
    ret[i++] = INT_NF.format(stats.getN());// Sample Size
    ret[i++] = DOUBLE_NF.format(stats.getMean());// Mean
    ret[i++] = INT_NF.format(stats.getPercentile(50));// Meadian
    ret[i++] = INT_NF.format(stats.getMin());// Min
    ret[i++] = INT_NF.format(stats.getMax());// Max
    ret[i++] = DOUBLE_NF.format(stats.getStandardDeviation());// Std Dev
    ret[i++] = DOUBLE_NF.format(stats.getKurtosis());// Kurtosis
    ret[i++] = DOUBLE_NF.format(stats.getSkewness());// Skewness
    ret[i++] = DOUBLE_NF.format(stats.getVariance());// Varience
    for (int n = 0; n < PERCENTILES.length; n++) {
        ret[i++] = INT_NF.format(stats.getPercentile((Integer) PERCENTILES[n][1]));// Percentiles
    }
    return ret;
}

From source file:com.spotify.annoy.jni.base.Benchmark.java

private static void dispStats(List<Long> queryTime) {
    DescriptiveStatistics s = new DescriptiveStatistics();

    for (Long t : queryTime) {
        s.addValue(t);//from   w w  w  . j  ava2  s  .  c o  m
    }

    System.out.print(new StringBuilder().append(String.format("Total time:  %.5fs\n", s.getSum() / 1.e9))
            .append(String.format("Mean time:   %.5fs\n", s.getMean() / 1.e9))
            .append(String.format("Median time: %.5fs\n", s.getPercentile(.5) / 1.e9))
            .append(String.format("Stddev time: %.5fs\n", s.getStandardDeviation() / 1.e9))
            .append(String.format("Min time:    %.5fs\n", s.getMin() / 1.e9))
            .append(String.format("Max time:    %.5fs\n", s.getMax() / 1.e9)).toString());
}

From source file:de.uniulm.omi.cloudiator.axe.aggregator.utils.Calc.java

public static Double MAX(List<Double> values) {
    DescriptiveStatistics ds = transform(values);

    return ds.getMax();
}

From source file:com.caseystella.analytics.outlier.streaming.mad.ConfusionMatrix.java

public static void printStats(String title, DescriptiveStatistics scoreStats) {
    System.out.println(/*ww  w  .j  a v a2  s  .c  o m*/
            title + ": " + "\n\tMin: " + scoreStats.getMin() + "\n\t1th: " + scoreStats.getPercentile(1)
                    + "\n\t5th: " + scoreStats.getPercentile(5) + "\n\t10th: " + scoreStats.getPercentile(10)
                    + "\n\t25th: " + scoreStats.getPercentile(25) + "\n\t50th: " + scoreStats.getPercentile(50)
                    + "\n\t90th: " + scoreStats.getPercentile(90) + "\n\t95th: " + scoreStats.getPercentile(95)
                    + "\n\t99th: " + scoreStats.getPercentile(99) + "\n\tMax: " + scoreStats.getMax());
}

From source file:ijfx.core.overlay.PixelStatisticsBase.java

public PixelStatisticsBase(DescriptiveStatistics stats) {

    setMean(stats.getMean());/*from  w  ww. j  a v  a 2  s . c om*/
    setMax(stats.getMax());
    setStandardDeviation(stats.getStandardDeviation());
    setVariance(stats.getVariance());
    setMedian(stats.getPercentile(50));
    setPixelCount(stats.getN());
    setMin(stats.getMin());

}

From source file:com.insightml.data.features.stats.FeatureStatistics.java

public Double getMax(final String feature) {
    final DescriptiveStatistics stat = stats.get(feature);
    return stat == null ? null : stat.getMax();
}

From source file:ijfx.core.overlay.DefaultPixelStatistics.java

public DefaultPixelStatistics(ImageDisplay display, Overlay overlay, Context context) {

    context.inject(this);

    Double[] valueList = overlayStatService.getValueListFromImageDisplay(display, overlay);

    DescriptiveStatistics statistics = new DescriptiveStatistics(ArrayUtils.toPrimitive(valueList));

    this.mean = statistics.getMean();
    this.max = statistics.getMax();
    this.min = statistics.getMin();
    this.standardDeviation = statistics.getStandardDeviation();
    this.variance = statistics.getVariance();
    this.median = statistics.getPercentile(MEDIAN_PERCENTILE);
    this.pixelCount = valueList.length;
}

From source file:ijfx.service.overlay.DefaultPixelStatistics.java

public DefaultPixelStatistics(ImageDisplay display, Overlay overlay, Context context) {

    context.inject(this);

    Double[] valueList = overlayStatService.getValueList(display, overlay);

    DescriptiveStatistics statistics = new DescriptiveStatistics(ArrayUtils.toPrimitive(valueList));

    this.mean = statistics.getMean();
    this.max = statistics.getMax();
    this.min = statistics.getMin();
    this.standardDeviation = statistics.getStandardDeviation();
    this.variance = statistics.getVariance();
    this.median = statistics.getPercentile(MEDIAN_PERCENTILE);
    this.pixelCount = valueList.length;
}

From source file:io.yields.math.concepts.operator.SmoothnessTest.java

@Spec(name = "linear data - first order smoothness", functional = SmoothnessTest.LinearData.class)
public void testLinearData_linearSmoothness(FunctionalContext<List<Tuple>> context) {
    //first order match should work
    DescriptiveStatistics stats = new Smoothness(1).apply(context.evaluate());
    assertThat(stats.getMin()).isEqualTo(stats.getMax(), Delta.delta(1.e-8)).isEqualTo(0d, Delta.delta(1.e-8));
}