Interface ActivationFunction

  • All Known Implementing Classes:
    LeakyRelu, Linear, Relu, Sigmoid, Tanh

    public interface ActivationFunction
    Common base interface for all activation functions used in layers. Classes implementing this interface should provide methods for calculating value and first derivative of the activation function. Activation function performs non-linear transformation of its input before its sent to layer output. First derivative of a function shows how fast and in what direction function is changing if its input changes, and it is used by training algorithm. For more see https://en.wikipedia.org/wiki/Activation_function
    Author:
    Zoran Sevarac
    See Also:
    ActivationType
    • Method Summary

      Modifier and Type Method Description
      static ActivationFunction create​(ActivationType type)
      Creates and returns specified type of activation function.
      float getPrime​(float y)
      Returns the first derivative of activation function for specified output y
      float getValue​(float x)
      Returns the value of activation function for specified input x
    • Method Detail

      • getValue

        float getValue​(float x)
        Returns the value of activation function for specified input x
        Parameters:
        x - input for activation
        Returns:
        value of activation function
      • getPrime

        float getPrime​(float y)
        Returns the first derivative of activation function for specified output y
        Parameters:
        y - output of activation function
        Returns:
        first derivative of activation function
      • create

        static ActivationFunction create​(ActivationType type)
        Creates and returns specified type of activation function. A factory method for creating activation functions;
        Parameters:
        type - type of the activation function
        Returns:
        returns instance of specified activation function type