Class MLP
java.lang.Object
smile.base.mlp.MultilayerPerceptron
smile.regression.MLP
- All Implemented Interfaces:
Serializable, AutoCloseable, 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 Regression
Regression.Trainer<T,M> -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionMLP(LayerBuilder... builders) Constructor.MLP(Scaler scaler, LayerBuilder... builders) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic MLPfit(double[][] x, double[] y, Properties params) Fits a MLP model.booleanonline()Returns true if this is an online learner.doublepredict(double[] x) Predicts the dependent variable of an instance.voidupdate(double[][] x, double[] y) Updates the model with a mini-batch.voidupdate(double[] x, double y) Updates the model with a single sample.Methods inherited from class MultilayerPerceptron
backpropagate, close, getClipNorm, getClipValue, getLearningRate, getMomentum, getWeightDecay, propagate, setClipNorm, setClipValue, setLearningRate, setMomentum, setParameters, setRMSProp, setWeightDecay, toString, update, vectorMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface 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:RegressionPredicts the dependent variable of an instance.- Specified by:
predictin interfaceRegression<double[]>- Parameters:
x- an instance.- Returns:
- the predicted value of dependent variable.
-
online
public boolean online()Description copied from interface:RegressionReturns true if this is an online learner.- Specified by:
onlinein 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:
updatein 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:
updatein 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 hyperparameters.- Returns:
- the model.
-