Example usage for org.apache.commons.math3.stat.descriptive.rank Median Median

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

Introduction

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

Prototype

public Median() 

Source Link

Document

Default constructor.

Usage

From source file:br.unicamp.ic.recod.gpsi.measures.gpsiDistanceOfMediansScore.java

@Override
public double score(double[][][] input) {

    Median median = new Median();

    RealMatrix matrix0 = MatrixUtils.createRealMatrix(input[0]);
    RealMatrix matrix1 = MatrixUtils.createRealMatrix(input[1]);

    return Math.abs(median.evaluate(matrix0.getColumn(0)) - median.evaluate(matrix1.getColumn(0)));

}

From source file:com.facebook.presto.benchmark.driver.Stat.java

public Stat(double[] values) {
    mean = new Mean().evaluate(values);
    standardDeviation = new StandardDeviation().evaluate(values);
    median = new Median().evaluate(values);
}

From source file:com.biomeris.i2b2.export.engine.misc.ObservationAggregator.java

public ObservationAggregator() {
    super();/* www . j  av  a  2s.c  om*/
    mean = new Mean();
    median = new Median();
    standardDeviation = new StandardDeviation();

    numericValues = new ArrayList<>();
    stringValues = new ArrayList<>();
}

From source file:com.left8.evs.edmodule.edcow.EDCoWThreshold.java

public double mad(double[] autoCorrelationValues) {
    double[] tempTable = new double[autoCorrelationValues.length];
    Median m = new Median();
    double medianValue = m.evaluate(autoCorrelationValues);
    for (int i = 0; i < autoCorrelationValues.length; i++) {
        tempTable[i] = Math.abs(autoCorrelationValues[i] - medianValue);
    }/*from w  w w  .jav a2s.c o  m*/
    return m.evaluate(tempTable); //return the median of tempTable, the equation (13) in the paper
}

From source file:fr.ens.transcriptome.aozan.util.StatisticsUtils.java

/**
 * Compute the median for values which are different of 0.
 * @return median or NaN if no values have been added, or 0.0 for a single
 *         value set./*from  w w  w.  j  av a  2  s  .  c om*/
 */
public Double getMedianWithoutZero() {

    buildDescriptiveStatisticsWithZero();

    return (this.dsWithoutZero.getN() == 0 ? 0.0 : new Median().evaluate(this.dsWithoutZero.getValues()));

}

From source file:com.left8.evs.edmodule.edcow.EDCoWThreshold.java

public double theta1(double[] autoCorrelationValues, double gama) {
    Median m = new Median();
    return (m.evaluate(autoCorrelationValues) + (gama * mad(autoCorrelationValues)));
}

From source file:fr.ens.transcriptome.aozan.util.StatisticsUtils.java

/**
 * Compute the median for values./*from   w  ww . j  av  a2 s .co  m*/
 * @return median or NaN if no values have been added, or 0.0 for a single
 *         value set.
 */
public Double getMediane() {
    return new Median().evaluate(this.ds.getValues());
}

From source file:com.left8.evs.edmodule.edcow.EDCoWThreshold.java

public double theta2(double[][] crossCorrelationValues, double gama) {
    double[] vecCrossCorrelation = transformMatrix(crossCorrelationValues);
    Median m = new Median();
    return (m.evaluate(vecCrossCorrelation) + (gama * mad(vecCrossCorrelation)));
}

From source file:com.moto.miletus.application.ble.neardevice.NearDeviceHolder.java

/**
 * whoWins/*from w w w .jav a 2  s . c om*/
 */
private void whoWins() {
    if (list.isEmpty() || list.size() == 1) {
        broadcastDeviceRoom(null);
        setNearDevice(null);
        return;
    }

    Set<BluetoothDevice> devices = new HashSet<>();
    for (Pair<BluetoothDevice, Double> pair : list) {
        devices.add(pair.first);
    }

    Set<Pair<BluetoothDevice, Double>> medians = new HashSet<>(devices.size());
    for (BluetoothDevice device : devices) {
        List<Double> rssi = new ArrayList<>();
        for (Pair<BluetoothDevice, Double> pair : list) {
            if (pair.first.equals(device)) {
                rssi.add(pair.second);
            }
        }

        Median median = new Median();
        median.setData(ArrayUtils.toPrimitive(rssi.toArray(new Double[rssi.size()])));
        medians.add(new Pair<>(device, median.evaluate()));
    }

    Pair<BluetoothDevice, Double> winner = new Pair<>(null, -999999d);
    for (Pair<BluetoothDevice, Double> median : medians) {
        if (median.second > winner.second) {
            winner = median;
        }
    }

    broadcastDeviceRoom(winner.first);
    setNearDevice(winner.first);
}

From source file:eu.crisis_economics.abm.algorithms.portfolio.returns.MedianOverHistoryStockReturnExpectationFunction.java

private double medianOfSeries(final double[] series) {
    Median median = new Median();
    median.setData(series);//w  ww. j a  v  a 2  s. com
    return median.evaluate(50);
}