Class OutputLayer

All Implemented Interfaces:
Backward, Forward, Layer<TensorBase>, Serializable
Direct Known Subclasses:
SoftmaxOutputLayer

public class OutputLayer extends AbstractLayer<TensorBase, TensorBase, Tensor2D>
Output layer of a neural network. It is always the last layer in a neural network, and gives the final output of a network.
See Also:
  • Field Details

    • outputErrors

      protected TensorBase outputErrors
    • labels

      protected final String[] labels
    • lossType

      protected LossType lossType
    • multithreaded

      protected transient boolean multithreaded
    • forwardTasks

      protected transient ArrayList<Callable<Void>> forwardTasks
    • backwardTasks

      protected transient ArrayList<Callable<Void>> backwardTasks
  • Constructor Details

    • OutputLayer

      public OutputLayer(int width)
      Creates an instance of output layer with specified width (number of outputs) and sigmoid activation function by default. Outputs are labeled using generic names "Output1, 2, 3..."
      Parameters:
      width - layer width which represents number of network outputs
    • OutputLayer

      public OutputLayer(int width, ActivationType actType)
      Creates an instance of output layer with specified width (number of outputs) and specified activation function. Outputs are labeled using generic names "Output1, 2, 3..."
      Parameters:
      width - layer width whic represents number of network outputs
      actType - activation function type for this layer
    • OutputLayer

      public OutputLayer(String[] outputLabels, ActivationType actType)
      Creates an instance of output layer with specified width (number of outputs) and linear activation function by default. Typically linear activation is used for regression tasks, while sigmoid activation is used for binary classification problems.
      Parameters:
      outputLabels - labels for network's outputs
      actType - activation function type for this layer
  • Method Details