Class Linear

java.lang.Object
com.jml.neural_network.activations.Linear
All Implemented Interfaces:
ActivationFunction

public class Linear extends Object implements ActivationFunction
The linear activation function. Applies the activation f(x)= x to the data. This is equivalent to having no activation for a layer.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    linalg.Matrix
    back​(linalg.Matrix data)
    Applies the derivative of the activation function, element-wise, to a matrix.
    linalg.Matrix
    forward​(linalg.Matrix data)
    Applies the activation function, element-wise, to a matrix.
    Gets the name of the activation function.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Linear

      public Linear()
  • Method Details

    • forward

      public linalg.Matrix forward(linalg.Matrix data)
      Applies the activation function, element-wise, to a matrix.
      Specified by:
      forward in interface ActivationFunction
      Parameters:
      data - The matrix to apply activation function to.
      Returns:
      The result of the element-wise activation function applied to the matrix.
    • back

      public linalg.Matrix back(linalg.Matrix data)
      Applies the derivative of the activation function, element-wise, to a matrix.
      Specified by:
      back in interface ActivationFunction
      Parameters:
      data - The matrix to apply the derivative of the activation function to.
      Returns:
      The slope of the activation function evaluated, element-wise, of the matrix.
    • getName

      public String getName()
      Gets the name of the activation function.
      Specified by:
      getName in interface ActivationFunction
      Returns:
      The name of the activation function as a String.