Package org.apache.commons.math3.distribution

Examples of org.apache.commons.math3.distribution.UniformRealDistribution.sample()


        }
        while (!keyIterator.hasNext()) {
          keyIterator = vectors.keySetIterator(); // Start over, a little imprecise but affects it not much
          Preconditions.checkState(keyIterator.hasNext());
          if (pascalDistribution != null) {
            keyIterator.skip(pascalDistribution.sample());
          }
        }
        float[] sampledVector = vectors.get(keyIterator.nextLong());
        mapRow[j] = new Node(sampledVector);
      }
View Full Code Here


        ResizableDoubleArray eDA2 = new ResizableDoubleArray(2);
        Assert.assertEquals("Initial number of elements should be 0", 0, eDA2.getNumElements());

        final IntegerDistribution randomData = new UniformIntegerDistribution(100, 1000);
        final int iterations = randomData.sample();

        for( int i = 0; i < iterations; i++) {
            eDA2.addElement( i );
        }
View Full Code Here

        ResizableDoubleArray eDA3 = new ResizableDoubleArray(3, 3.0f, 3.5f);
        Assert.assertEquals("Initial number of elements should be 0", 0, eDA3.getNumElements() );

        final IntegerDistribution randomData = new UniformIntegerDistribution(100, 3000);
        final int iterations = randomData.sample();

        for( int i = 0; i < iterations; i++) {
            eDA3.addElement( i );
        }
View Full Code Here

     * @return array of random double values
     */
    private double[] generateSample() {
        final IntegerDistribution size = new UniformIntegerDistribution(10, 100);
        final RealDistribution randomData = new UniformRealDistribution(-100, 100);
        final int sampleSize = size.sample();
        final double[] out = randomData.sample(sampleSize);
        return out;
    }

    /**
 
View Full Code Here

        // Fill weights array with random int values between 1 and 5
        int[] intWeights = new int[len];
        final IntegerDistribution weightDist = new UniformIntegerDistribution(1, 5);
        for (int i = 0; i < len; i++) {
            intWeights[i] = weightDist.sample();
            weights[i] = intWeights[i];
        }

        // Fill values array with random data from N(mu, sigma)
        // and fill valuesList with values from values array with
View Full Code Here

        // and fill valuesList with values from values array with
        // values[i] repeated weights[i] times, each i
        final RealDistribution valueDist = new NormalDistribution(mu, sigma);
        List<Double> valuesList = new ArrayList<Double>();
        for (int i = 0; i < len; i++) {
            double value = valueDist.sample();
            values[i] = value;
            for (int j = 0; j < intWeights[i]; j++) {
                valuesList.add(new Double(value));
            }
        }
View Full Code Here

            // get the "real" cannonball position
            double x = cannonball.getX();
            double y = cannonball.getY();
           
            // apply measurement noise to current cannonball position
            double nx = x + dist.sample();
            double ny = y + dist.sample();

            cannonball.step();
           
            filter.predict(controlVector);
View Full Code Here

            double x = cannonball.getX();
            double y = cannonball.getY();
           
            // apply measurement noise to current cannonball position
            double nx = x + dist.sample();
            double ny = y + dist.sample();

            cannonball.step();
           
            filter.predict(controlVector);
            // correct the filter with our measurements
View Full Code Here

            // get the "real" cannonball position
            double x = cannonball.getX();
            double y = cannonball.getY();
           
            // apply measurement noise to current cannonball position
            double nx = x + dist.sample();
            double ny = y + dist.sample();

            cannonball.step();
           
            filter.predict(controlVector);
View Full Code Here

            double x = cannonball.getX();
            double y = cannonball.getY();
           
            // apply measurement noise to current cannonball position
            double nx = x + dist.sample();
            double ny = y + dist.sample();

            cannonball.step();
           
            filter.predict(controlVector);
            // correct the filter with our measurements
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.