Class MLP

All Implemented Interfaces:
Serializable, ToDoubleFunction<double[]>, Regression<double[]>

public class MLP extends MultilayerPerceptron implements 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:
  • Constructor Details

    • MLP

      public MLP(LayerBuilder... builders)
      Constructor.
      Parameters:
      builders - the builders of input and hidden layers from bottom to top.
    • MLP

      public MLP(Scaler scaler, LayerBuilder... builders)
      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 interface Regression<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 interface Regression<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 interface Regression<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 if rho > 0.
      Specified by:
      update in interface Regression<double[]>
      Parameters:
      x - the training instances.
      y - the response variables.
    • fit

      public static MLP fit(double[][] x, double[] y, Properties params)
      Fits a MLP model.
      Parameters:
      x - the training dataset.
      y - the response variable.
      params - the hyper-parameters.
      Returns:
      the model.