public class FanInBasedWeightInitializer extends java.lang.Object implements WeightInitializer
[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.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
|
Modifier and Type | Method and Description |
---|---|
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.
|
public FanInBasedWeightInitializer()
public FanInBasedWeightInitializer(double aBoundary)
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.public FanInBasedWeightInitializer(double aLowerBound, double anUpperBound)
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.public void initialize(Matrix aMatrix)
WeightInitializer
initialize
in interface WeightInitializer
aMatrix
- the weights (biases) to be initialized.public void setSqrtFanIn(boolean aMode)
true
the square root of the fan-in will be used, otherwise
the normal fan-in will be used (default mode).aMode
- the mode to use, true
for the square root of
the fan-in, false
for the normal fan-in.public boolean isSqrtFanIn()
public double getLowerBound()
public void setLowerBound(double aLowerBound)
aLowerBound
- the new lower bound.public double getUpperBound()
public void setUpperBound(double anUpperBound)
anUpperBound
- the new upper bound.Submit Feedback to pmarrone@users.sourceforge.net