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

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

Introduction

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

Prototype

public double evaluate(final double p) throws MathIllegalArgumentException 

Source Link

Document

Returns the result of evaluating the statistic over the stored data.

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);//www  .ja v a  2  s . co m
    zLimits[0] = p.evaluate(0.1);
    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);//  w  w  w . j a v  a  2s  . c  o  m
    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:/* w w w .j a va 2  s .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 float getPrecisionLowerBound() {
    Percentile percentile = new Percentile();
    percentile.setData(/* ww  w  .  j  a v a  2 s .c om*/
            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> 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:com.github.rvesse.github.pr.stats.PullRequestStats.java

private void outputPercentile(Frequency freq, Percentile percentiles, int p, String metric) {
    long value = (long) percentiles.evaluate((double) p);
    System.out.println("  " + p + "% (" + value + " " + metric + "): " + (long) freq.getCumFreq(value));
}

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

public Pair<Float, Float> getPrecisionCI() {
    Percentile percentile = new Percentile();
    percentile.setData(//  w  w w.j a  v a  2s.  co m
            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)));
}