Examples of Mean


Examples of org.apache.commons.math3.stat.descriptive.moment.Mean

    public void displayStatistics(Sample[] samples, int threadNo) {
        long start = Long.MAX_VALUE;
        long finish = 0;
       
        Mean mean = new Mean();
        StandardDeviation stdDev = new StandardDeviation();
        Skewness skewness = new Skewness();
       
        int n = 0;
        for(Sample sample: samples) {
            if (threadNo == -1 || threadNo == sample.threadId) {
                n++;
                if (sample.timestamp < start) {
                    start = sample.timestamp;
                }
                if (sample.timestamp + sample.duration > finish) {
                    finish = sample.timestamp + sample.duration;
                }
                mean.increment(sample.duration);
                stdDev.increment(sample.duration);
                skewness.increment(sample.duration);
            }
        }
       
        double throughPut = (double)n * (double)TimeUnit.SECONDS.toNanos(1) / (double)(finish - start);
       
        System.out.println(String.format("Mean(NS)    %.1f", mean.getResult()));
        System.out.println(String.format("StdDev(NS)  %.1f", stdDev.getResult()));
        System.out.println(String.format("Skew(NS)    %.1f", skewness.getResult()));
        System.out.println(String.format("Throughput  %.1f", throughPut));
        System.out.println(String.format("Total time  %.3f", (finish - start) / (double)TimeUnit.SECONDS.toNanos(1)));
       
View Full Code Here

Examples of org.apache.commons.math3.stat.descriptive.moment.Mean

     * @throws  MathIllegalArgumentException if the arrays lengths do not match or
     * there is insufficient data
     */
    public double covariance(final double[] xArray, final double[] yArray, boolean biasCorrected)
        throws MathIllegalArgumentException {
        Mean mean = new Mean();
        double result = 0d;
        int length = xArray.length;
        if (length != yArray.length) {
            throw new MathIllegalArgumentException(
                  LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, length, yArray.length);
        } else if (length < 2) {
            throw new MathIllegalArgumentException(
                  LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE, length, 2);
        } else {
            double xMean = mean.evaluate(xArray);
            double yMean = mean.evaluate(yArray);
            for (int i = 0; i < length; i++) {
                double xDev = xArray[i] - xMean;
                double yDev = yArray[i] - yMean;
                result += (xDev * yDev - result) / (i + 1);
            }
View Full Code Here

Examples of tv.floe.metronome.clustering.kmeans.Mean

    Point one = new Point(1,1);
   
    Point half = new Point(0.5, 0.5);
    Point quarter = new Point(0.25, 0.25);
   
    Mean averager = new Mean();
    averager.add(zero);
    averager.add(one);
   
    Point averageA = averager.toPoint();
    assertEquals(half, averageA);
   
    averager.reset();
    averager.add(zero);
    averager.add(zero);
    averager.add(zero);
    averager.add(one);
   
    Point averageB = averager.toPoint();
    assertEquals(quarter, averageB);
  }
View Full Code Here

Examples of zdenekdrahos.Statistics.Characteristics.Mean

        settings.separator = new DataSeparator();
        settings.feedForward = new FeedForward();
        settings.backPropagation = new BackPropagation();
        settings.simulation = new Simulation();
        settings.errorCalculator = new LeastSquares();
        settings.meanCalculator = new Mean();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.