public abstract class MultilayerPerceptron
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected double |
epsilon
A small constant for numerical stability in RMSProp.
|
protected double |
lambda
The L2 regularization factor, which is also the weight decay factor.
|
protected smile.math.TimeFunction |
learningRate
The learning rate.
|
protected smile.math.TimeFunction |
momentum
The momentum factor.
|
protected Layer[] |
net
The hidden layers.
|
protected OutputLayer |
output
The output layer.
|
protected int |
p
The dimensionality of input data.
|
protected double |
rho
The discounting factor for the history/coming gradient in RMSProp.
|
protected int |
t
The training iterations.
|
protected java.lang.ThreadLocal<double[]> |
target
The buffer to store desired target value of training instance.
|
Constructor and Description |
---|
MultilayerPerceptron(Layer... net)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
backpropagate(double[] x,
boolean update)
Propagates the errors back through the network.
|
double |
getLearningRate()
Returns the learning rate.
|
double |
getMomentum()
Returns the momentum factor.
|
double |
getWeightDecay()
Returns the weight decay factor.
|
protected void |
propagate(double[] x)
Propagates the signals through the neural network.
|
void |
setLearningRate(smile.math.TimeFunction rate)
Sets the learning rate.
|
void |
setMomentum(smile.math.TimeFunction momentum)
Sets the momentum factor.
|
void |
setRMSProp(double rho,
double epsilon)
Sets RMSProp parameters.
|
void |
setWeightDecay(double lambda)
Sets the weight decay factor.
|
java.lang.String |
toString() |
protected void |
update(int m)
Updates the weights for mini-batch training.
|
protected int p
protected OutputLayer output
protected Layer[] net
protected transient java.lang.ThreadLocal<double[]> target
protected smile.math.TimeFunction learningRate
protected smile.math.TimeFunction momentum
protected double rho
protected double epsilon
protected double lambda
protected int t
public MultilayerPerceptron(Layer... net)
net
- the layers from bottom to top.
The input layer should not be included.public java.lang.String toString()
toString
in class java.lang.Object
public void setLearningRate(smile.math.TimeFunction rate)
rate
- the learning rate.public void setMomentum(smile.math.TimeFunction momentum)
momentum
- the momentum factor.public void setRMSProp(double rho, double epsilon)
rho
- The discounting factor for the history/coming gradient.epsilon
- A small constant for numerical stability.public void setWeightDecay(double lambda)
public double getLearningRate()
public double getMomentum()
public double getWeightDecay()
protected void propagate(double[] x)
protected void backpropagate(double[] x, boolean update)
update
- the flag if update the weights directly.
It should be false for (mini-)batch.protected void update(int m)
m
- the mini-batch size.