org.apache.commons.math3.optimization.general
Class RandomStraightLinePointGenerator

java.lang.Object
  extended by org.apache.commons.math3.optimization.general.RandomStraightLinePointGenerator

public class RandomStraightLinePointGenerator
extends Object

Factory for generating a cloud of points that approximate a straight line.


Constructor Summary
RandomStraightLinePointGenerator(double a, double b, double sigma, double lo, double hi, long seed)
          The generator will create a cloud of points whose x-coordinates will be randomly sampled between xLo and xHi, and the corresponding y-coordinates will be computed as y = a x + b + N(0, error) where N(mean, sigma) is a Gaussian distribution with the given mean and standard deviation.
 
Method Summary
 Point2D.Double[] generate(int n)
          Point generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomStraightLinePointGenerator

public RandomStraightLinePointGenerator(double a,
                                        double b,
                                        double sigma,
                                        double lo,
                                        double hi,
                                        long seed)
The generator will create a cloud of points whose x-coordinates will be randomly sampled between xLo and xHi, and the corresponding y-coordinates will be computed as

  y = a x + b + N(0, error)
 
where N(mean, sigma) is a Gaussian distribution with the given mean and standard deviation.

Parameters:
a - Slope.
b - Intercept.
sigma - Standard deviation on the y-coordinate of the point.
lo - Lowest value of the x-coordinate.
hi - Highest value of the x-coordinate.
seed - RNG seed.
Method Detail

generate

public Point2D.Double[] generate(int n)
Point generator.

Parameters:
n - Number of points to create.
Returns:
the cloud of n points.


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.