Package org.apache.commons.math.stat.descriptive

Examples of org.apache.commons.math.stat.descriptive.DescriptiveStatistics


            }
        }
    }

    private DescriptiveStatistics runTest(Repository repository) throws Exception {
        DescriptiveStatistics statistics = new DescriptiveStatistics();

        setUp(repository, CREDENTIALS);
        try {
           
            // Run a few iterations to warm up the system
            long warmupEnd = System.currentTimeMillis() + WARMUP;
            while (System.currentTimeMillis() < warmupEnd) {
                execute();
            }

            // Run test iterations, and capture the execution times
            long runtimeEnd = System.currentTimeMillis() + RUNTIME;
            while (System.currentTimeMillis() < runtimeEnd) {
                statistics.addValue(execute());
            }
        } finally {
            tearDown();
        }
View Full Code Here


      scoresForEntity.get(surf).add(ne.getConfidence());
    }
    averageScores = new HashMap<String,Double>();
    maxScores = new HashMap<String,Double>();
    for(String surf : scoresForEntity.keySet()) {
      DescriptiveStatistics descStats = new DescriptiveStatisticsImpl();
      for(double score : scoresForEntity.get(surf)) {
        descStats.addValue(score);
      }
      maxScores.put(surf, descStats.getMax());
      averageScores.put(surf, descStats.getMean());
    }
   
    Map<Token,NamedEntity> neByLastToken = new HashMap<Token,NamedEntity>();
    for(NamedEntity ne : entities) {
      if(!ne.isBlocked()) {
View Full Code Here

     * @param sample sample to normalize
     * @return normalized (standardized) sample
     * @since 2.2
     */
    public static double[] normalize(final double[] sample) {
        DescriptiveStatistics stats = new DescriptiveStatistics();

        // Add the data from the series to stats
        for (int i = 0; i < sample.length; i++) {
            stats.addValue(sample[i]);
        }

        // Compute mean and standard deviation
        double mean = stats.getMean();
        double standardDeviation = stats.getStandardDeviation();

        // initialize the standardizedSample, which has the same length as the sample
        double[] standardizedSample = new double[sample.length];

        for (int i = 0; i < sample.length; i++) {
View Full Code Here

        String[] columns = new String[] {"Fitness", "StdDev+", "StdDev-", "Max", "Min"};
       
        this.chartNames.add(chartName);
       
        DescriptiveStatistics  stat = new DescriptiveStatistics();
       
        for (RobEA rob : env.getAgents()) {
            stat.addValue(rob.getFitSum());
        }
       
        ChartEvent event1 = new ChartEvent(chartName, columns[0], stat.getMean());
        ChartEvent event2 = new ChartEvent(chartName, columns[1], stat.getMean() + stat.getStandardDeviation());
        ChartEvent event3 = new ChartEvent(chartName, columns[2], stat.getMean() - stat.getStandardDeviation());
        ChartEvent event4 = new ChartEvent(chartName, columns[3], stat.getMax());
        ChartEvent event5 = new ChartEvent(chartName, columns[4], stat.getMin());
        event1.setyAxisLabel("Fitness");
        event1.setLineColor(Color.black);
        event1.setLineStroke(new BasicStroke(3));
        event2.setLineColor(Color.gray);
        event3.setLineColor(Color.gray);
View Full Code Here

    }

    private MutSeqVerf measureMut;
   
    public void createUniversalityCharts(EnvironmentEA env, ParCollection params) {
        DescriptiveStatistics stat = new DescriptiveStatistics();
        String chartNamePrefix = "UnivChart-Level";
        String[] columns = new String[] {"Fitness", "StdDev+", "StdDev-", "Max", "Min"};

        for (int level = 1; level < this.levelAnzahl() - 1; level++) {
            String chartName = chartNamePrefix + level;
           
            this.chartNames.add(chartName);
           
            MeasureTranslatorGenerality measure = new MeasureTranslatorGenerality(this.measureMut, 99, 100, 100, rand, params);
           
            for (RobEA rob : env.getAgents()) {
                List<Integer> werte = measure.measureManyTimes(this.getAutomat(rob.id(), level, env), 3);
                double sum = 0;
               
                // Durchschnitt berechnen.
                for (double d : werte) {
                    sum += d;
                }
               
                stat.addValue(1 / (sum / werte.size()));
            }

            ChartEvent event1 = new ChartEvent(chartName, columns[0], stat.getMean());
            ChartEvent event2 = new ChartEvent(chartName, columns[1], stat.getMean() + stat.getStandardDeviation());
            ChartEvent event3 = new ChartEvent(chartName, columns[2], stat.getMean() - stat.getStandardDeviation());
            ChartEvent event4 = new ChartEvent(chartName, columns[3], stat.getMax());
            ChartEvent event5 = new ChartEvent(chartName, columns[4], stat.getMin());
           
            event1.setyAxisLabel("Universality");
            event1.setLineColor(Color.black);
            event1.setLineStroke(new BasicStroke(3));
            event2.setLineColor(Color.gray);
View Full Code Here

        for (RepositoryFixture fixture : fixtures) {
            try {
                Repository[] cluster = fixture.setUpCluster(1);
                try {
                    // Run the test
                    DescriptiveStatistics statistics = runTest(cluster[0]);
                    if (statistics.getN() > 0) {
                        System.out.format(
                                "%-28.28s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f  %6d%n",
                                fixture.toString(),
                                statistics.getMin(),
                                statistics.getPercentile(10.0),
                                statistics.getPercentile(50.0),
                                statistics.getPercentile(90.0),
                                statistics.getMax(),
                                statistics.getN());
                    }
                } finally {
                    fixture.tearDownCluster();
                }
            } catch (Exception e) {
View Full Code Here

    private static final Credentials CREDENTIALS =
            new SimpleCredentials("admin", "admin".toCharArray());

    private DescriptiveStatistics runTest(Repository repository) throws Exception {
        DescriptiveStatistics statistics = new DescriptiveStatistics();

        setUp(repository, CREDENTIALS);
        try {
            // Run a few iterations to warm up the system
            for (int i = 0; i < 5; i++) {
                execute();
            }

            // Run test iterations, and capture the execution times
            int iterations = 0;
            long runtimeEnd =
                    System.currentTimeMillis()
                    + TimeUnit.MILLISECONDS.convert(1, TimeUnit.MINUTES);
            while (iterations++ < 10
                    || System.currentTimeMillis() < runtimeEnd) {
                statistics.addValue(execute());
            }
        } finally {
            tearDown();
        }
View Full Code Here

        this.gets.clear();
      }
      super.testTakedown();
      if (opts.reportLatency) {
        Arrays.sort(times);
        DescriptiveStatistics ds = new DescriptiveStatistics();
        for (double t : times) {
          ds.addValue(t);
        }
        LOG.info("randomRead latency log (ms), on " + times.length + " measures");
        LOG.info("99.9999% = " + ds.getPercentile(99.9999d));
        LOG.info(" 99.999% = " + ds.getPercentile(99.999d));
        LOG.info("  99.99% = " + ds.getPercentile(99.99d));
        LOG.info("   99.9% = " + ds.getPercentile(99.9d));
        LOG.info("     99% = " + ds.getPercentile(99d));
        LOG.info("     95% = " + ds.getPercentile(95d));
        LOG.info("     90% = " + ds.getPercentile(90d));
        LOG.info("     80% = " + ds.getPercentile(80d));
        LOG.info("Standard Deviation = " + ds.getStandardDeviation());
        LOG.info("Mean = " + ds.getMean());
      }
    }
View Full Code Here

   * Return a commons math DescriptiveStatistics class which is contructed from double array d
   * @param d samples
   * @return a DescriptiveStatistics class which is contructed from double array d
   */
  public static DescriptiveStatistics getStats(double[] d){
    DescriptiveStatistics stats = DescriptiveStatistics.newInstance();
    for(int i =0; i < d.length; i++){
      stats.addValue(d[i]);
    }
    return stats;
  }
View Full Code Here

        this.gets.clear();
      }
      super.testTakedown();
      if (opts.reportLatency) {
        Arrays.sort(times);
        DescriptiveStatistics ds = new DescriptiveStatistics();
        for (double t : times) {
          ds.addValue(t);
        }
        LOG.info("randomRead latency log (ms), on " + times.length + " measures");
        LOG.info("99.9999% = " + ds.getPercentile(99.9999d));
        LOG.info(" 99.999% = " + ds.getPercentile(99.999d));
        LOG.info("  99.99% = " + ds.getPercentile(99.99d));
        LOG.info("   99.9% = " + ds.getPercentile(99.9d));
        LOG.info("     99% = " + ds.getPercentile(99d));
        LOG.info("     95% = " + ds.getPercentile(95d));
        LOG.info("     90% = " + ds.getPercentile(90d));
        LOG.info("     80% = " + ds.getPercentile(80d));
        LOG.info("Standard Deviation = " + ds.getStandardDeviation());
        LOG.info("Mean = " + ds.getMean());
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.math.stat.descriptive.DescriptiveStatistics

Copyright © 2018 www.massapicom. 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.