Package org.uncommons.maths.statistics

Examples of org.uncommons.maths.statistics.DataSet.addValue()


        DataSet data = new DataSet(iterations);
        for (int i = 0; i < iterations; i++)
        {
            int value = generator.nextValue();
            assert value >= 0 : "Value must be non-negative: " + value;
            data.addValue(value);
        }
        assert Maths.approxEquals(data.getArithmeticMean(), expectedMean, 0.02)
                : "Observed mean outside acceptable range: " + data.getArithmeticMean();
        assert Maths.approxEquals(data.getSampleStandardDeviation(), expectedStandardDeviation, 0.02)
                : "Observed standard deviation outside acceptable range: " + data.getSampleStandardDeviation();
View Full Code Here


    {
        final int iterations = 10000;
        DataSet data = new DataSet(iterations);
        for (int i = 0; i < iterations; i++)
        {
            data.addValue(generator.nextValue());
        }
        assert Maths.approxEquals(data.getArithmeticMean(), expectedMean, 0.02)
                : "Observed mean outside acceptable range: " + data.getArithmeticMean();
        assert Maths.approxEquals(data.getSampleStandardDeviation(), expectedStandardDeviation, 0.02)
                : "Observed standard deviation outside acceptable range: " + data.getSampleStandardDeviation();
View Full Code Here

        DataSet data = new DataSet(iterations);
        for (int i = 0; i < iterations; i++)
        {
            int value = generator.nextValue();
            assert value >= 0 && value <= n : "Value out-of-range: " + value;
            data.addValue(value);
        }
        assert Maths.approxEquals(data.getArithmeticMean(), expectedMean, 0.02d)
                : "Observed mean outside acceptable range: " + data.getArithmeticMean();
        assert Maths.approxEquals(data.getSampleStandardDeviation(), expectedStandardDeviation, 0.02)
                : "Observed standard deviation outside acceptable range: " + data.getSampleStandardDeviation();
View Full Code Here

        DataSet data = new DataSet(iterations);
        for (int i = 0; i < iterations; i++)
        {
            int value = generator.nextValue();
            assert value >= min && value <= max : "Value out-of-range: " + value;
            data.addValue(value);
        }
        assert Maths.approxEquals(data.getArithmeticMean(), expectedMean, 0.02)
            : "Observed mean outside acceptable range: " + data.getArithmeticMean();
        assert Maths.approxEquals(data.getSampleStandardDeviation(), standardDeviation, 0.02)
            : "Observed standard deviation outside acceptable range: " + data.getSampleStandardDeviation();
View Full Code Here

        DataSet data = new DataSet(iterations);
        for (int i = 0; i < iterations; i++)
        {
            double value = generator.nextValue();
            assert value >= min && value <= max : "Value out-out-of-range: " + value;
            data.addValue(value);
        }
        assert Maths.approxEquals(data.getArithmeticMean(), expectedMean, 0.02)
            : "Observed mean outside acceptable range: " + data.getArithmeticMean();
        assert Maths.approxEquals(data.getSampleStandardDeviation(), standardDeviation, 0.02)
            : "Observed standard deviation outside acceptable range: " + data.getSampleStandardDeviation();
View Full Code Here

                                                          int iterations)
    {
        DataSet dataSet = new DataSet(iterations);
        for (int i = 0; i < iterations; i++)
        {
            dataSet.addValue(rng.nextInt(maxValue));
        }
        return dataSet.getSampleStandardDeviation();
    }
}
View Full Code Here

        final int iterations = 10000;
        DataSet data = new DataSet(iterations);
        for (int i = 0; i < iterations; i++)
        {
            data.addValue(generator.nextValue());
        }
        // Exponential distribution appears to be a bit more volatile than the others in
        // terms of conforming to expectations, so use a 4% tolerance here, instead of the 2%
        // used for other distributions, to avoid too many false positives.
        assert Maths.approxEquals(data.getArithmeticMean(), expectedMean, 0.04d)
View Full Code Here

                              Random rng)
    {
        DataSet statistics = new DataSet(population.size());
        for (EvaluatedCandidate<S> candidate : population)
        {
            statistics.addValue(candidate.getFitness());
        }

        List<EvaluatedCandidate<S>> scaledPopulation = new ArrayList<EvaluatedCandidate<S>>(population.size());
        for (EvaluatedCandidate<S> candidate : population)
        {
View Full Code Here

                                                          long startTime)
    {
        DataSet stats = new DataSet(evaluatedPopulation.size());
        for (EvaluatedCandidate<T> candidate : evaluatedPopulation)
        {
            stats.addValue(candidate.getFitness());
        }
        return new PopulationData<T>(evaluatedPopulation.get(0).getCandidate(),
                                     evaluatedPopulation.get(0).getFitness(),
                                     stats.getArithmeticMean(),
                                     stats.getStandardDeviation(),
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.