Class Sigmoid

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

public class Sigmoid extends Object implements ActivationFunction
The sigmoid activation function. f(x) = 1/(1+exp(-x))
  • 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 sigmoid activation function element-wise to a matrix.
    linalg.Matrix
    forward​(linalg.Matrix data)
    Applies the sigmoid activation 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

    • Sigmoid

      public Sigmoid()
  • Method Details

    • forward

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

      public linalg.Matrix back(linalg.Matrix data)
      Applies the derivative of the sigmoid activation function element-wise to a matrix.
      Specified by:
      back in interface ActivationFunction
      Parameters:
      data - Matrix to apply the derivative of the sigmoid activation function to.
      Returns:
      The result of the derivative of the sigmoid activation applied element-wise to the data.
    • 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.