org.joone.engine.weights
Class FanInBasedWeightInitializer
- java.lang.Object
-
- 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].LBandUBstand 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_iis the fan-in, i.e. the total number of inputs) of neuron i. There is also an option to use instead ofF_ithe square root ofF_i, which is also used in some cases.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublegetLowerBound()Gets the lower bound.doublegetUpperBound()Gets the upper bound.voidinitialize(Matrix aMatrix)Initializes weights (biases) represented by the matrix.booleanisSqrtFanIn()Checks if the mode of the fan-in is the square root mode, i.e.voidsetLowerBound(double aLowerBound)Sets the lower bound.voidsetSqrtFanIn(boolean aMode)Sets the flag indicating the mode of the fan-in to use.voidsetUpperBound(double anUpperBound)Sets the upper bound.
-
-
-
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], whereF_iis 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:WeightInitializerInitializes weights (biases) represented by the matrix.- Specified by:
initializein interfaceWeightInitializer- 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 totruethe 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,truefor the square root of the fan-in,falsefor 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.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG