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

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


                new int[]{10, 0, 0, 0},
                false);
        rp.reset(-3806751651286565680L);
        System.out.println("Random Seed = " + rp.getSeed());
        System.out.println("NM Seed = " + CC.getNameManager().getSeed());
        DescriptiveStatistics timeStats = new DescriptiveStatistics();
        DescriptiveStatistics trysStats = new DescriptiveStatistics();
        int count = 0;
        while (++count < 500) {
            CC.resetTensorNames();
            Product from = rp.nextProduct(15);
            Product target = from.clone();

            long start = System.nanoTime();
            ProductsBijectionsPort port = new ProductsBijectionsPort(from.getContent(), target.getContent());

            int[] bijection;
            boolean good = false;
            int trys = 0;
            OUTER:
            while (trys++ < 5000 && (bijection = port.take()) != null) {
                for (int i = 0; i < bijection.length; ++i)
                    if (bijection[i] != i)
                        continue OUTER;
                good = true;
                break;
            }

            double millis = 1E-6 * (System.nanoTime() - start);
            timeStats.addValue(millis);
            trysStats.addValue(trys);

            if (!good)
                throw new RuntimeException();
        }
        System.out.println(timeStats);
View Full Code Here


//        Product t = rp.nextPermutation();
//        ContractionsGraphDrawer.drawToPngFile(t, "/home/stas/Projects/Durty/", "Huge1");


        DescriptiveStatistics timeStats = new DescriptiveStatistics();
        DescriptiveStatistics trysStats = new DescriptiveStatistics();
        int count = -1;
        while (++count < 100) {
            CC.resetTensorNames();
            Product from = rp.nextProduct(15);
            Product target = from.clone();

            long start = System.nanoTime();
            Tensor[] dataFrom = from.getContent().getDataCopy();
            Tensor[] dataTarget = target.getContent().getDataCopy();
//             if (count == 6)
//                ContractionsGraphDrawer.drawToPngFile(from, "/home/stas/Projects/Durty/", "Huge6");
            if (count == 24)
                ContractionsGraphDrawer.drawToPngFile(from, "/home/stas/Projects/Durty/", "Huge24");
            if (count == 30)
                ContractionsGraphDrawer.drawToPngFile(from, "/home/stas/Projects/Durty/", "Huge30");
            ProductsBijectionsPort port = new ProductsBijectionsPort(from.getContent(), target.getContent());

//            List<int[]> bijections = new ArrayList<>();
            int[] bijection;
            boolean good = false;
            int trys = 0;
            OUTER:
            while (trys++ < 5000 && (bijection = port.take()) != null)
//                System.out.println(Arrays.toString(bijection));
//                bijections.add(bijection.clone());
                if (IndexMappings.createBijectiveProductPort(dataFrom, dataTo(dataTarget, bijection), false).take() != null) {
                    good = true;
                    System.out.println(count + "  " + trys);
                    break;
                }
//            if (trys == 3169) {
//                ContractionsGraphDrawer.drawToPngFile(from, "/home/stas/Projects/Durty/", "Worst");
//                for (int[] b : bijections)
//                    System.out.println(Arrays.toString(b));
//            }
            double millis = 1E-6 * (System.nanoTime() - start);
            timeStats.addValue(millis);
            trysStats.addValue(trys);

            if (!good)
                throw new RuntimeException();
        }
        System.out.println(timeStats);
View Full Code Here

//        Product t = rp.nextPermutation();
//        ContractionsGraphDrawer.drawToPngFile(t, "/home/stas/Projects/Durty/", "Huge1");


        DescriptiveStatistics timeStats = new DescriptiveStatistics();
        DescriptiveStatistics trysStats = new DescriptiveStatistics();
        int count = -1;
        while (++count < 10) {
            CC.resetTensorNames();
            Product from = rp.nextProduct(15);
            Product target = from.clone();

//            if (from.getContent().getFullContractionStructure().componentCount != 1) {
//                System.out.println(from.getContent().getFullContractionStructure().componentCount);
//                continue;
//            }

            System.out.println(from.size());

            long start = System.nanoTime();
            ProductsBijectionsPort port = new ProductsBijectionsPort(from.getContent(), target.getContent());

            int[] bijection;
            boolean good = false;
            int trys = 0;
            OUTER:
            while ((bijection = port.take()) != null && trys++ < 5000);
            if (trys != 0)
                good = true;
            double millis = 1E-6 * (System.nanoTime() - start);
            timeStats.addValue(millis);
            trysStats.addValue(trys);

            if (!good)
                throw new RuntimeException();
        }
        System.out.println(timeStats);
View Full Code Here

                new int[]{10, 0, 0, 0},
                false);
        rp.reset(-3806751651286565680L);
        System.out.println("Random Seed = " + rp.getSeed());
        System.out.println("NM Seed = " + CC.getNameManager().getSeed());
        DescriptiveStatistics timeStats = new DescriptiveStatistics();
        DescriptiveStatistics trysStats = new DescriptiveStatistics();
        int count = 0;
        while (++count < 500) {
            CC.resetTensorNames();
            Product from = rp.nextProduct(15);
            Product target = from.clone();

            long start = System.nanoTime();
            ProductsBijectionsPort port = new ProductsBijectionsPort(from.getContent(), target.getContent());
            Tensor[] dataFrom = from.getContent().getDataCopy();
            Tensor[] dataTarget = target.getContent().getDataCopy();
//            List<int[]> bijections = new ArrayList<>();
            int[] bijection;
            boolean good = false;
            int trys = 0;
            OUTER:
            while (trys++ < 5000 && (bijection = port.take()) != null)
//                bijections.add(bijection.clone());
                if (IndexMappings.createBijectiveProductPort(dataFrom, dataTo(dataTarget, bijection), false).take() != null) {
                    good = true;
                    break;
                }
//            if (trys == 3169) {
//                ContractionsGraphDrawer.drawToPngFile(from, "/home/stas/Projects/Durty/", "Worst");
//                for (int[] b : bijections)
//                    System.out.println(Arrays.toString(b));
//            }
            double millis = 1E-6 * (System.nanoTime() - start);
            timeStats.addValue(millis);
            trysStats.addValue(trys);

            if (!good)
                throw new RuntimeException();
        }
        System.out.println(timeStats);
View Full Code Here

                concurrencyLevels = Arrays.asList(1);
            }

            for (Integer concurrency: concurrencyLevels) {
                // Run the test
                DescriptiveStatistics statistics = runTest(concurrency);
                if (statistics.getN() > 0) {
                    System.out.format(
                            "%-28.28s  %6d  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f  %6d%n",
                            fixture.toString(),
                            concurrency,
                            statistics.getMin(),
                            statistics.getPercentile(10.0),
                            statistics.getPercentile(50.0),
                            statistics.getPercentile(90.0),
                            statistics.getMax(),
                            statistics.getN());
                    if (out != null) {
                        out.format(
                                "%-28.28s, %6d, %6.0f, %6.0f, %6.0f, %6.0f, %6.0f, %6d%n",
                                fixture.toString(),
                                concurrency,
                                statistics.getMin(),
                                statistics.getPercentile(10.0),
                                statistics.getPercentile(50.0),
                                statistics.getPercentile(90.0),
                                statistics.getMax(),
                                statistics.getN());
                    }
                }

            }
        } finally {
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

  }

  public Map<String, DescriptiveStatistics> getCoprocessorExecutionStatistics() {
    Map<String, DescriptiveStatistics> results = new HashMap<String, DescriptiveStatistics>();
    for (RegionEnvironment env : coprocessors) {
      DescriptiveStatistics ds = new DescriptiveStatistics();
      if (env.getInstance() instanceof RegionObserver) {
        for (Long time : env.getExecutionLatenciesNanos()) {
          ds.addValue(time);
        }
        // Ensures that web ui circumvents the display of NaN values when there are zero samples.
        if (ds.getN() == 0) {
          ds.addValue(0);
        }
        results.put(env.getInstance().getClass().getSimpleName(), ds);
      }
    }
    return results;
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

  }

  public Map<String, DescriptiveStatistics> getCoprocessorExecutionStatistics() {
    Map<String, DescriptiveStatistics> results = new HashMap<String, DescriptiveStatistics>();
    for (RegionEnvironment env : coprocessors) {
      DescriptiveStatistics ds = new DescriptiveStatistics();
      if (env.getInstance() instanceof RegionObserver) {
        for (Long time : env.getExecutionLatenciesNanos()) {
          ds.addValue(time);
        }
        // Ensures that web ui circumvents the display of NaN values when there are zero samples.
        if (ds.getN() == 0) {
          ds.addValue(0);
        }
        results.put(env.getInstance().getClass().getSimpleName(), ds);
      }
    }
    return results;
View Full Code Here

     * Test DescriptiveStatistics - implementations that store full array of
     * values and execute multi-pass algorithms
     */
    public void testDescriptiveStatistics() throws Exception {

        DescriptiveStatistics u = new DescriptiveStatistics();
       
        loadStats("data/PiDigits.txt", u);
        assertEquals("PiDigits: std", std, u.getStandardDeviation(), 1E-14);
        assertEquals("PiDigits: mean", mean, u.getMean(), 1E-14);
       
        loadStats("data/Mavro.txt", u);
        assertEquals("Mavro: std", std, u.getStandardDeviation(), 1E-14);
        assertEquals("Mavro: mean", mean, u.getMean(), 1E-14);       
       
        loadStats("data/Michelso.txt", u);
        assertEquals("Michelso: std", std, u.getStandardDeviation(), 1E-14);
        assertEquals("Michelso: mean", mean, u.getMean(), 1E-14);  

        loadStats("data/NumAcc1.txt", u);
        assertEquals("NumAcc1: std", std, u.getStandardDeviation(), 1E-14);
        assertEquals("NumAcc1: mean", mean, u.getMean(), 1E-14);
       
        loadStats("data/NumAcc2.txt", u);
        assertEquals("NumAcc2: std", std, u.getStandardDeviation(), 1E-14);
        assertEquals("NumAcc2: mean", mean, u.getMean(), 1E-14);
    }
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.