Class FeedForwardNetwork

All Implemented Interfaces:
TrainerProvider<BackpropagationTrainer>, Serializable, AutoCloseable

public final class FeedForwardNetwork extends NeuralNetwork<BackpropagationTrainer>
Feed forward neural network architecture, also known as Multi Layer Perceptron. It consists of a sequence of neural network layers deepnetts.net.layers trained by Back-propagation BackpropagationTrainer algorithm. As a minimum network must have input InputLayer and output layer OutputLayer. For non-trivial problems it will also need several hidden fully connected layers FullyConnectedLayer. The easiest and recommended way to create an instance of a neural network is by using FeedForwardNetwork.Builder This type of network can be used for both classification and regression tasks depending how it is configured.

For a quick explanation about essential principles behind feed forward neural networks see the tutorial From Basic Machine Learning to Deep Learning in 5 Minutes

For a quick overview of machine learning basics required to understand Feed Forward Network see Machine Learning Tutorial for Java Developers

See Also:
  • Method Details

    • setInput

      public void setInput(float... inputs)
      Sets network's input using given inputs and invokes the calculation of the network for the given input (forward pass). This method is usually used only during the training. You don't have to use it before the call to predict(float...) since predict() method sets given inputs and returns calculated outputs.
      Overrides:
      setInput in class NeuralNetwork<BackpropagationTrainer>
      Parameters:
      inputs - array of inputs to the network given as array of float values
      Throws:
      IllegalArgumentException - if size of the input vector does not match the number of the inputs of a network
    • predict

      public float[] predict(float... inputs)
      Returns the network's prediction (outputs) for the given input.
      Parameters:
      inputs - array of inputs to the network given as array of float values
      Returns:
      model's prediction as network's output
      Throws:
      IllegalArgumentException - if size of the input vector does not match the number of the inputs of a network
    • getOutput

      @Deprecated public float[] getOutput(float[] inputs)
      Deprecated.
      Returns network output for the given input. This method is deprecated and predict method should be used instead.
      Parameters:
      inputs -
      Returns:
    • builder

      public static FeedForwardNetwork.Builder builder()
      Returns a builder for the FeedForwardNetwork
      Returns:
      builder instance