org.joone.engine.weights
Class FanInBasedWeightInitializer

java.lang.Object
  extended by org.joone.engine.weights.FanInBasedWeightInitializer
All Implemented Interfaces:
java.io.Serializable, WeightInitializer

public class FanInBasedWeightInitializer
extends java.lang.Object
implements WeightInitializer

The weights are uniformly distributed (that is randomly) within the range [LB/F_i, UB/F_i]. LB and UB stand for lower bound and upper bound, which is a certain number. Here the bounds will be by default -2.4 and 2.4 as described in Neural Networks - A Comprehensive Foundation, Haykin, chapter 6.7 Some Hints for Making the Back-Propagation Algorithm Perform Better. F_i is the fan-in, i.e. the total number of inputs) of neuron i. There is also an option to use instead of F_i the square root of F_i, which is also used in some cases.

Author:
Boris Jansen
See Also:
Serialized Form

Constructor Summary
FanInBasedWeightInitializer()
          Creates a new instance of FanInBasedWeightInitializer.
FanInBasedWeightInitializer(double aBoundary)
          Creates a new instance of FanInBasedWeightInitializer.
FanInBasedWeightInitializer(double aLowerBound, double anUpperBound)
          Creates a new instance of FanInBasedWeightInitializer
 
Method Summary
 double getLowerBound()
          Gets the lower bound.
 double getUpperBound()
          Gets the upper bound.
 void initialize(Matrix aMatrix)
          Initializes weights (biases) represented by the matrix.
 boolean isSqrtFanIn()
          Checks if the mode of the fan-in is the square root mode, i.e.
 void setLowerBound(double aLowerBound)
          Sets the lower bound.
 void setSqrtFanIn(boolean aMode)
          Sets the flag indicating the mode of the fan-in to use.
 void setUpperBound(double anUpperBound)
          Sets the upper bound.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FanInBasedWeightInitializer

public FanInBasedWeightInitializer()
Creates a new instance of FanInBasedWeightInitializer. It uses it default values +/- 2.4 for the bounds and the normal fan-in.


FanInBasedWeightInitializer

public FanInBasedWeightInitializer(double aBoundary)
Creates a new instance of FanInBasedWeightInitializer.

Parameters:
aBoundary - the boundary to use to init the weights ([-aBoundary/F_i, aBoundary/F_i], where F_i is the fan-in of neuron i.

FanInBasedWeightInitializer

public FanInBasedWeightInitializer(double aLowerBound,
                                   double anUpperBound)
Creates a new instance of FanInBasedWeightInitializer

Parameters:
aLowerBound - the lower boundary to use divided by the fan-in of a neuron.
anUpperBound - the upper boundary to use divided by the fan-in of a neuron.
Method Detail

initialize

public void initialize(Matrix aMatrix)
Description copied from interface: WeightInitializer
Initializes weights (biases) represented by the matrix.

Specified by:
initialize in interface WeightInitializer
Parameters:
aMatrix - the weights (biases) to be initialized.

setSqrtFanIn

public void setSqrtFanIn(boolean aMode)
Sets the flag indicating the mode of the fan-in to use. If set to true the square root of the fan-in will be used, otherwise the normal fan-in will be used (default mode).

Parameters:
aMode - the mode to use, true for the square root of the fan-in, false for the normal fan-in.

isSqrtFanIn

public boolean isSqrtFanIn()
Checks if the mode of the fan-in is the square root mode, i.e. the square root of the fan-in is used or if the normal mode, i.e. the normal fan-in is used.

Returns:
true if the square root of the fan-in is used, false otherwise.

getLowerBound

public double getLowerBound()
Gets the lower bound.

Returns:
the lower bound.

setLowerBound

public void setLowerBound(double aLowerBound)
Sets the lower bound.

Parameters:
aLowerBound - the new lower bound.

getUpperBound

public double getUpperBound()
Gets the upper bound.

Returns:
the upper bound.

setUpperBound

public void setUpperBound(double anUpperBound)
Sets the upper bound.

Parameters:
anUpperBound - the new upper bound.


Submit Feedback to pmarrone@users.sourceforge.net