Class Tanh

java.lang.Object
smile.deep.activation.Tanh
All Implemented Interfaces:
Serializable, ActivationFunction

public class Tanh extends Object implements ActivationFunction
Hyperbolic tangent activation function. The tanh function is a rescaling of the logistic sigmoid, such that its outputs range from -1 to 1.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    f(double[] x)
    The output function.
    void
    g(double[] g, double[] y)
    The gradient function.
    Returns the name of activation function.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Tanh

      public Tanh()
      Constructor.
  • Method Details

    • name

      public String name()
      Description copied from interface: ActivationFunction
      Returns the name of activation function.
      Specified by:
      name in interface ActivationFunction
      Returns:
      the name of activation function.
    • f

      public void f(double[] x)
      Description copied from interface: ActivationFunction
      The output function.
      Specified by:
      f in interface ActivationFunction
      Parameters:
      x - the input vector.
    • g

      public void g(double[] g, double[] y)
      Description copied from interface: ActivationFunction
      The gradient function.
      Specified by:
      g in interface ActivationFunction
      Parameters:
      g - the gradient vector. On input, it holds W'*g, where W and g are the weight matrix and gradient of upper layer, respectively. On output, it is the gradient of this layer.
      y - the output vector.