org.encog.mathutil.randomize
Class BasicRandomizer

java.lang.Object
  extended by org.encog.mathutil.randomize.BasicRandomizer
All Implemented Interfaces:
Randomizer
Direct Known Subclasses:
ConsistentRandomizer, ConstRandomizer, Distort, FanInRandomizer, GaussianRandomizer, RangeRandomizer

public abstract class BasicRandomizer
extends Object
implements Randomizer

Provides basic functionality that most randomizers will need.

Author:
jheaton

Constructor Summary
BasicRandomizer()
          Construct a random number generator with a random(current time) seed.
 
Method Summary
 Random getRandom()
           
 double nextDouble()
           
 double nextDouble(double min, double max)
          Generate a random number in the specified range.
 void randomize(BasicNetwork network, int fromLayer)
          Randomize one level of a neural network.
 void randomize(double[] d)
          Randomize the array based on an array, modify the array.
 void randomize(double[][] d)
          Randomize the 2d array based on an array, modify the array.
 void randomize(double[] d, int begin, int size)
          Randomize the array based on an array, modify the array.
 void randomize(Matrix m)
          Randomize the matrix based on an array, modify the array.
 void randomize(MLMethod method)
          Randomize the synapses and biases in the basic network based on an array, modify the array.
 void setRandom(Random theRandom)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.encog.mathutil.randomize.Randomizer
randomize
 

Constructor Detail

BasicRandomizer

public BasicRandomizer()
Construct a random number generator with a random(current time) seed. If you want to set your own seed, just call "getRandom().setSeed".

Method Detail

getRandom

public final Random getRandom()
Returns:
The random number generator in use. Use this to set the seed, if desired.

nextDouble

public final double nextDouble()
Returns:
The next double.

nextDouble

public final double nextDouble(double min,
                               double max)
Generate a random number in the specified range.

Parameters:
min - The minimum value.
max - The maximum value.
Returns:
A random number.

randomize

public void randomize(BasicNetwork network,
                      int fromLayer)
Randomize one level of a neural network.

Parameters:
network - The network to randomize
fromLayer - The from level to randomize.

randomize

public void randomize(double[] d)
Randomize the array based on an array, modify the array. Previous values may be used, or they may be discarded, depending on the randomizer.

Specified by:
randomize in interface Randomizer
Parameters:
d - An array to randomize.

randomize

public void randomize(double[] d,
                      int begin,
                      int size)
Randomize the array based on an array, modify the array. Previous values may be used, or they may be discarded, depending on the randomizer.

Specified by:
randomize in interface Randomizer
Parameters:
d - An array to randomize.
begin - The beginning element of the array.
size - The size of the array to copy.

randomize

public void randomize(double[][] d)
Randomize the 2d array based on an array, modify the array. Previous values may be used, or they may be discarded, depending on the randomizer.

Specified by:
randomize in interface Randomizer
Parameters:
d - An array to randomize.

randomize

public void randomize(Matrix m)
Randomize the matrix based on an array, modify the array. Previous values may be used, or they may be discarded, depending on the randomizer.

Specified by:
randomize in interface Randomizer
Parameters:
m - A matrix to randomize.

randomize

public void randomize(MLMethod method)
Randomize the synapses and biases in the basic network based on an array, modify the array. Previous values may be used, or they may be discarded, depending on the randomizer.

Specified by:
randomize in interface Randomizer
Parameters:
method - A network to randomize.

setRandom

public final void setRandom(Random theRandom)
Parameters:
theRandom - the random to set


Copyright © 2012. All Rights Reserved.