Package smile.regression
Class MLP
java.lang.Object
smile.base.mlp.MultilayerPerceptron
smile.regression.MLP
- All Implemented Interfaces:
Serializable
,ToDoubleFunction<double[]>
,Regression<double[]>
Fully connected multilayer perceptron neural network for regression.
An MLP consists of at least three layers of nodes: an input layer,
a hidden layer and an output layer. The nodes are interconnected
through weighted acyclic arcs from each preceding layer to the
following, without lateral or feedback connections. Each node
calculates a transformed weighted linear combination of its inputs
(output activations from the preceding layer), with one of the weights
acting as a trainable bias connected to a constant input. The
transformation, called activation function, is a bounded non-decreasing
(non-linear) function.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface smile.regression.Regression
Regression.Trainer<T,
M extends Regression<T>> -
Field Summary
-
Constructor Summary
ConstructorDescriptionMLP
(LayerBuilder... builders) Constructor.MLP
(Scaler scaler, LayerBuilder... builders) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic MLP
fit
(double[][] x, double[] y, Properties params) Fits a MLP model.boolean
online()
Returns true if this is an online learner.double
predict
(double[] x) Predicts the dependent variable of an instance.void
update
(double[][] x, double[] y) Updates the model with a mini-batch.void
update
(double[] x, double y) Updates the model with a single sample.Methods inherited from class smile.base.mlp.MultilayerPerceptron
backpropagate, getClipNorm, getClipValue, getLearningRate, getMomentum, getWeightDecay, propagate, setClipNorm, setClipValue, setLearningRate, setMomentum, setParameters, setRMSProp, setWeightDecay, toString, update
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface smile.regression.Regression
applyAsDouble, predict, predict, predict, update
-
Constructor Details
-
MLP
Constructor.- Parameters:
builders
- the builders of input and hidden layers from bottom to top.
-
MLP
Constructor.- Parameters:
scaler
- the scaling function of output values.builders
- the builders of input and hidden layers from bottom to top.
-
-
Method Details
-
predict
public double predict(double[] x) Description copied from interface:Regression
Predicts the dependent variable of an instance.- Specified by:
predict
in interfaceRegression<double[]>
- Parameters:
x
- an instance.- Returns:
- the predicted value of dependent variable.
-
online
public boolean online()Description copied from interface:Regression
Returns true if this is an online learner.- Specified by:
online
in interfaceRegression<double[]>
- Returns:
- true if online learner.
-
update
public void update(double[] x, double y) Updates the model with a single sample. RMSProp is not applied.- Specified by:
update
in interfaceRegression<double[]>
- Parameters:
x
- the training instance.y
- the response variable.
-
update
public void update(double[][] x, double[] y) Updates the model with a mini-batch. RMSProp is applied ifrho > 0
.- Specified by:
update
in interfaceRegression<double[]>
- Parameters:
x
- the training instances.y
- the response variables.
-
fit
Fits a MLP model.- Parameters:
x
- the training dataset.y
- the response variable.params
- the hyper-parameters.- Returns:
- the model.
-