org.encog.mathutil.randomize

## Class FanInRandomizer

- java.lang.Object
- - org.encog.mathutil.randomize.BasicRandomizer
  - - org.encog.mathutil.randomize.FanInRandomizer

- All Implemented Interfaces:
    Randomizer

      public class FanInRandomizer
      extends BasicRandomizer

  A randomizer that attempts to create starting weight values that are conducive to propagation training. This is one of the best randomizers offered in Encog, however, the Nguyen Widrow method generally performs better. From: Neural Networks - A Comprehensive Foundation, Haykin, chapter 6.7
  Author:
    jheaton

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FanInRandomizer()` Create a fan-in randomizer with default values.
    `FanInRandomizer(double boundary, boolean sqrt)` Construct a fan-in randomizer along the specified boundary.
    `FanInRandomizer(double aLowerBound, double anUpperBound, boolean sqrt)` Construct a fan-in randomizer.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `randomize(BasicNetwork network, int fromLayer)` Randomize one level of a neural network.
    `double` | `randomize(double d)` Starting with the specified number, randomize it to the degree specified by this randomizer.
    `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(Matrix m)` Randomize the matrix based on an array, modify the array.

    - ### Methods inherited from class org.encog.mathutil.randomize.BasicRandomizer

      `getRandom, nextDouble, nextDouble, randomize, randomize, setRandom`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FanInRandomizer

          public FanInRandomizer()

      Create a fan-in randomizer with default values.

    - #### FanInRandomizer

          public FanInRandomizer(double boundary,
                         boolean sqrt)

      Construct a fan-in randomizer along the specified boundary. The min will be -boundary and the max will be boundary.
      Parameters:
        `boundary` - The boundary for the fan-in.
        `sqrt` - Should the square root of the rows to be used in the calculation.

    - #### FanInRandomizer

          public FanInRandomizer(double aLowerBound,
                         double anUpperBound,
                         boolean sqrt)

      Construct a fan-in randomizer. Use the specified bounds.
      Parameters:
        `aLowerBound` - The lower bound.
        `anUpperBound` - The upper bound.
        `sqrt` - True if the square root of the rows should be used in the calculation.

  - ### Method Detail

    - #### randomize

          public double randomize(double d)

      Starting with the specified number, randomize it to the degree specified by this randomizer. This could be a totally new random number, or it could be based on the specified number.
      Parameters:
        `d` - The number to randomize.
      Returns:
        A randomized number.

    - #### 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`
      Overrides:
        `randomize` in class `BasicRandomizer`
      Parameters:
        `d` - An array to randomize.

    - #### 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`
      Overrides:
        `randomize` in class `BasicRandomizer`
      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`
      Overrides:
        `randomize` in class `BasicRandomizer`
      Parameters:
        `m` - A matrix to randomize.

    - #### randomize

          public void randomize(BasicNetwork network,
                       int fromLayer)

      Randomize one level of a neural network.
      Overrides:
        `randomize` in class `BasicRandomizer`
      Parameters:
        `network` - The network to randomize
        `fromLayer` - The from level to randomize.

Copyright © 2014. All Rights Reserved.