Example usage for org.apache.commons.math.stat.descriptive DescriptiveStatistics DescriptiveStatistics

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

Introduction

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

Prototype

public DescriptiveStatistics() 

Source Link

Document

Construct a DescriptiveStatistics instance with an infinite window

Usage

From source file:org.jgap.gp.function.Mean.java

@Override
public double execute_double(ProgramChromosome c, int n, Object[] args) {
    int size = size();
    DescriptiveStatistics stats = new DescriptiveStatistics();
    for (int i = 0; i < size; i++) {
        stats.addValue(c.execute_double(n, i, args));
    }//from www.j  ava  2 s.c om
    return stats.getMean();
}

From source file:org.jgap.gp.function.statistics.Kurtosis.java

@Override
public double execute_double(ProgramChromosome c, int n, Object[] args) {
    int size = size();
    DescriptiveStatistics stats = new DescriptiveStatistics();
    for (int i = 0; i < size; i++) {
        stats.addValue(c.execute_double(n, i, args));
    }//from  w w w .  j av  a  2  s .co m
    return stats.getKurtosis();
}

From source file:org.jgap.gp.function.statistics.Kurtosis.java

@Override
public float execute_float(ProgramChromosome c, int n, Object[] args) {
    int size = size();
    DescriptiveStatistics stats = new DescriptiveStatistics();
    for (int i = 0; i < size; i++) {
        stats.addValue(c.execute_float(n, i, args));
    }/*from w ww  .j  a  va2  s.co m*/
    return (float) stats.getKurtosis();
}

From source file:org.jgap.gp.function.statistics.Skewness.java

@Override
public double execute_double(ProgramChromosome c, int n, Object[] args) {
    int size = size();
    DescriptiveStatistics stats = new DescriptiveStatistics();
    for (int i = 0; i < size; i++) {
        stats.addValue(c.execute_double(n, i, args));
    }//w  ww  . j a  v  a  2  s  .c o m
    return stats.getSkewness();
}

From source file:org.jgap.gp.function.statistics.Skewness.java

@Override
public float execute_float(ProgramChromosome c, int n, Object[] args) {
    int size = size();
    DescriptiveStatistics stats = new DescriptiveStatistics();
    for (int i = 0; i < size; i++) {
        stats.addValue(c.execute_float(n, i, args));
    }//from   www  .j av  a 2  s. c  o  m
    return (float) stats.getSkewness();
}

From source file:org.jgap.gp.function.statistics.StandardDeviation.java

@Override
public double execute_double(ProgramChromosome c, int n, Object[] args) {
    int size = size();
    DescriptiveStatistics stats = new DescriptiveStatistics();
    for (int i = 0; i < size; i++) {
        stats.addValue(c.execute_double(n, i, args));
    }//from   w ww. j  a  v  a  2 s .co  m
    return stats.getStandardDeviation();
}

From source file:org.jgap.gp.function.statistics.StandardDeviation.java

@Override
public float execute_float(ProgramChromosome c, int n, Object[] args) {
    int size = size();
    DescriptiveStatistics stats = new DescriptiveStatistics();
    for (int i = 0; i < size; i++) {
        stats.addValue(c.execute_float(n, i, args));
    }/* w  w w. j  a v a2  s  .  c  o m*/
    return (float) stats.getStandardDeviation();
}

From source file:org.jgap.gp.function.statistics.Variance.java

@Override
public double execute_double(ProgramChromosome c, int n, Object[] args) {
    int size = size();
    DescriptiveStatistics stats = new DescriptiveStatistics();
    for (int i = 0; i < size; i++) {
        stats.addValue(c.execute_double(n, i, args));
    }/* w w  w  . j a v a  2  s .c  om*/
    return stats.getVariance();
}

From source file:org.jgap.gp.function.statistics.Variance.java

@Override
public float execute_float(ProgramChromosome c, int n, Object[] args) {
    int size = size();
    DescriptiveStatistics stats = new DescriptiveStatistics();
    for (int i = 0; i < size; i++) {
        stats.addValue(c.execute_float(n, i, args));
    }/*from   www  .ja va  2 s  .  c  o  m*/
    return (float) stats.getVariance();
}

From source file:org.matsim.contrib.common.stats.Correlations.java

/**
 * /*  w w w .  jav  a 2  s .  co  m*/
 * @param valuesX
 *            a set of values.
 * @param valuesY
 *            a set of values.
 * @param discretizer
 *            a discretizer applied to the elements of <tt>valuesX</tt>.
 * @return a map where the keys are the elements of <tt>valuesX</tt> and
 *         where the values are descriptive statistics objects of a subset
 *         of <tt>valuesY</tt> the index of which is equal to elements of
 *         <tt>valuesX</tt> with equal value. The elements of
 *         <tt>valuesX</tt> are discretized with <tt>discretizer</tt>.
 */
public static TDoubleObjectHashMap<DescriptiveStatistics> statistics(double[] valuesX, double[] valuesY,
        Discretizer discretizer) {
    if (valuesX.length != valuesY.length)
        throw new IllegalArgumentException("Both arrays must not differ in size!");

    TDoubleObjectHashMap<DescriptiveStatistics> map = new TDoubleObjectHashMap<DescriptiveStatistics>();

    for (int i = 0; i < valuesX.length; i++) {
        double x = discretizer.discretize(valuesX[i]);
        DescriptiveStatistics stats = map.get(x);
        if (stats == null) {
            stats = new DescriptiveStatistics();
            map.put(x, stats);
        }
        stats.addValue(valuesY[i]);
    }

    return map;
}