Class OutputLayer

java.lang.Object
smile.base.mlp.Layer
smile.base.mlp.OutputLayer
All Implemented Interfaces:
Serializable

public class OutputLayer extends Layer
The output layer in the neural network.
See Also:
  • Constructor Details

    • OutputLayer

      public OutputLayer(int n, int p, OutputFunction activation, Cost cost)
      Constructor.
      Parameters:
      n - the number of neurons.
      p - the number of input variables (not including bias value).
      activation - the output activation function.
      cost - the cost function.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • cost

      public Cost cost()
      Returns the cost function of neural network.
      Returns:
      the cost function.
    • transform

      public void transform(double[] x)
      Description copied from class: Layer
      The activation or output function.
      Specified by:
      transform in class Layer
      Parameters:
      x - the input and output values.
    • backpropagate

      public void backpropagate(double[] lowerLayerGradient)
      Description copied from class: Layer
      Propagates the errors back to a lower layer.
      Specified by:
      backpropagate in class Layer
      Parameters:
      lowerLayerGradient - the gradient vector of lower layer.
    • computeOutputGradient

      public void computeOutputGradient(double[] target, double weight)
      Compute the network output gradient.
      Parameters:
      target - the desired output.
      weight - a positive weight value associated with the training instance.