mlpack
Static Public Member Functions | List of all members
mlpack::ann::TanhFunction Class Reference

The tanh function, defined by. More...

#include <tanh_function.hpp>

Static Public Member Functions

static double Fn (const double x)
 Computes the tanh function. More...
 
template<typename InputVecType , typename OutputVecType >
static void Fn (const InputVecType &x, OutputVecType &y)
 Computes the tanh function. More...
 
static double Deriv (const double y)
 Computes the first derivative of the tanh function. More...
 
template<typename InputVecType , typename OutputVecType >
static void Deriv (const InputVecType &y, OutputVecType &x)
 Computes the first derivatives of the tanh function. More...
 
static double Inv (const double y)
 Computes the inverse of the tanh function. More...
 
template<typename InputVecType , typename OutputVecType >
static void Inv (const InputVecType &y, OutputVecType &x)
 Computes the inverse of the tanh function. More...
 

Detailed Description

The tanh function, defined by.

\begin{eqnarray*} f(x) &=& \frac{e^x - e^{-x}}{e^x + e^{-x}} \\ f'(x) &=& 1 - \tanh^2(x) \\ f^{-1}(x) &=& \arctan(x) \end{eqnarray*}

Member Function Documentation

◆ Deriv() [1/2]

static double mlpack::ann::TanhFunction::Deriv ( const double  y)
inlinestatic

Computes the first derivative of the tanh function.

Parameters
yInput activation.
Returns
f'(x)

◆ Deriv() [2/2]

template<typename InputVecType , typename OutputVecType >
static void mlpack::ann::TanhFunction::Deriv ( const InputVecType &  y,
OutputVecType &  x 
)
inlinestatic

Computes the first derivatives of the tanh function.

Parameters
yInput activations.
xThe resulting derivatives.

◆ Fn() [1/2]

static double mlpack::ann::TanhFunction::Fn ( const double  x)
inlinestatic

Computes the tanh function.

Parameters
xInput data.
Returns
f(x).

◆ Fn() [2/2]

template<typename InputVecType , typename OutputVecType >
static void mlpack::ann::TanhFunction::Fn ( const InputVecType &  x,
OutputVecType &  y 
)
inlinestatic

Computes the tanh function.

Parameters
xInput data.
yThe resulting output activation.

◆ Inv() [1/2]

static double mlpack::ann::TanhFunction::Inv ( const double  y)
inlinestatic

Computes the inverse of the tanh function.

Parameters
yInput data.
Returns
f^{-1}(x)

◆ Inv() [2/2]

template<typename InputVecType , typename OutputVecType >
static void mlpack::ann::TanhFunction::Inv ( const InputVecType &  y,
OutputVecType &  x 
)
inlinestatic

Computes the inverse of the tanh function.

Parameters
yInput data.
xThe resulting inverse of the input data.

The documentation for this class was generated from the following file: