Example usage for org.apache.commons.math3.stat.descriptive.rank Percentile setData

List of usage examples for org.apache.commons.math3.stat.descriptive.rank Percentile setData

Introduction

In this page you can find the example usage for org.apache.commons.math3.stat.descriptive.rank Percentile setData.

Prototype

@Override
public void setData(final double[] values) 

Source Link

Usage

From source file:com.cidre.algorithms.CidreMath.java

public static double[] zLimitsFromPercentiles(double[] values) {
    double[] zLimits = new double[2];
    Percentile p = new Percentile();
    p.setData(values);
    zLimits[0] = p.evaluate(0.1);/*from  w  w  w . j  av  a2  s  .  c om*/
    zLimits[1] = p.evaluate(99.9);
    log.debug("zLimits {}, {}", zLimits[0], zLimits[1]);
    return zLimits;
}

From source file:edu.jhuapl.bsp.detector.OpenMath.java

public static double prctile(double[] in, double p) {
    Percentile prc = new Percentile();
    double in2[] = copya(in);
    Arrays.sort(in2);/*from   w w w .j  a  v  a 2s. c  om*/
    prc.setData(in2);
    double result = prc.evaluate(p);
    return result;
}

From source file:com.mgmtp.perfload.perfalyzer.binning.PerfMonBinningStrategy.java

private void writeAggregatedLine(final WritableByteChannel destChannel) throws IOException {
    double[] allValues = binManager.flatValuesStream().toArray();

    StrBuilder sb = new StrBuilder();

    String min = intNumberFormat.format(Doubles.min(allValues));
    String max = intNumberFormat.format(Doubles.max(allValues));

    switch (typeConfig) {
    case CPU://  www.  ja  v a  2s .co m
    case IO:
    case JAVA:
        String mean = intNumberFormat.format(StatUtils.mean(allValues));
        appendEscapedAndQuoted(sb, DELIMITER, min, mean, max);
        break;
    case MEM:
    case SWAP:
        Percentile percentile = new Percentile();
        percentile.setData(allValues);
        String q10 = intNumberFormat.format(percentile.evaluate(10d));
        String q50 = intNumberFormat.format(percentile.evaluate(50d));
        String q90 = intNumberFormat.format(percentile.evaluate(90d));
        appendEscapedAndQuoted(sb, DELIMITER, min, q10, q50, q90, max);
        break;
    default:
        throw new IllegalStateException("Invalid perfMon data type");
    }

    writeLineToChannel(destChannel, sb.toString(), Charsets.UTF_8);
}

From source file:edu.umd.umiacs.clip.tools.classifier.ConfusionMatrix.java

public float getF1LowerBound() {
    Percentile percentile = new Percentile();
    percentile.setData(Stream.of(sampleFromPosterior()).parallel().mapToDouble(cm -> cm.getF1()).toArray());
    return (float) percentile.evaluate(100 * (1 - CONF_LEVEL));
}

From source file:edu.umd.umiacs.clip.tools.classifier.ConfusionMatrix.java

public float getRecallLowerBound() {
    Percentile percentile = new Percentile();
    percentile.setData(Stream.of(sampleFromPosterior()).parallel().mapToDouble(cm -> cm.getRecall()).toArray());
    return (float) percentile.evaluate(100 * (1 - CONF_LEVEL));
}

From source file:edu.umd.umiacs.clip.tools.classifier.ConfusionMatrix.java

public Pair<Float, Float> getF1CI() {
    Percentile percentile = new Percentile();
    percentile.setData(Stream.of(sampleFromPosterior()).parallel().mapToDouble(cm -> cm.getF1()).toArray());
    double alpha = (1 - CONF_LEVEL) / 2;
    return Pair.of((float) percentile.evaluate(100 * alpha), (float) percentile.evaluate(100 * (1 - alpha)));
}

From source file:edu.umd.umiacs.clip.tools.classifier.ConfusionMatrix.java

public Pair<Float, Float> getRecallCI() {
    Percentile percentile = new Percentile();
    percentile.setData(Stream.of(sampleFromPosterior()).parallel().mapToDouble(cm -> cm.getRecall()).toArray());
    double alpha = (1 - CONF_LEVEL) / 2;
    return Pair.of((float) percentile.evaluate(100 * alpha), (float) percentile.evaluate(100 * (1 - alpha)));
}

From source file:edu.umd.umiacs.clip.tools.classifier.ConfusionMatrix.java

public float getPrecisionLowerBound() {
    Percentile percentile = new Percentile();
    percentile.setData(
            Stream.of(sampleFromPosterior()).parallel().mapToDouble(cm -> cm.getPrecision()).toArray());
    return (float) percentile.evaluate(100 * (1 - CONF_LEVEL));
}

From source file:edu.umd.umiacs.clip.tools.classifier.ConfusionMatrix.java

public Pair<Float, Float> getPrecisionCI() {
    Percentile percentile = new Percentile();
    percentile.setData(
            Stream.of(sampleFromPosterior()).parallel().mapToDouble(cm -> cm.getPrecision()).toArray());
    double alpha = (1 - CONF_LEVEL) / 2;
    return Pair.of((float) percentile.evaluate(100 * alpha), (float) percentile.evaluate(100 * (1 - alpha)));
}

From source file:info.mikaelsvensson.devtools.analysis.shared.AbstractLog.java

public Percentile getPercentileCalculator(Collection<T> samples) {
    double[] responseTimes = toDurationDoubles(samples);
    Arrays.sort(responseTimes);//w ww.  ja  v a2 s . co  m
    Percentile percentile = new Percentile();
    percentile.setData(responseTimes);
    return percentile;
}