mlpack  master
Public Member Functions | Private Member Functions | Private Attributes | List of all members
mlpack::ann::ELU< InputDataType, OutputDataType > Class Template Reference

The ELU activation function, defined by. More...

Public Member Functions

 ELU (const double alpha=1.0)
 Create the ELU object using the specified parameters. More...
 
double const & Alpha () const
 Get the non zero gradient. More...
 
double & Alpha ()
 Modify the non zero gradient. More...
 
template<typename DataType >
void Backward (const DataType &&input, DataType &&gy, DataType &&g)
 Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards through f. More...
 
OutputDataType const & Delta () const
 Get the delta. More...
 
OutputDataType & Delta ()
 Modify the delta. More...
 
template<typename InputType , typename OutputType >
void Forward (const InputType &&input, OutputType &&output)
 Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More...
 
InputDataType const & InputParameter () const
 Get the input parameter. More...
 
InputDataType & InputParameter ()
 Modify the input parameter. More...
 
OutputDataType const & OutputParameter () const
 Get the output parameter. More...
 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...
 
template<typename Archive >
void Serialize (Archive &ar, const unsigned int)
 Serialize the layer. More...
 

Private Member Functions

double Deriv (const double y)
 Computes the first derivative of the ELU function. More...
 
template<typename InputType , typename OutputType >
void Deriv (const InputType &x, OutputType &y)
 Computes the first derivative of the ELU function. More...
 
double fn (const double x)
 Computes the ELU function. More...
 
template<typename eT >
void fn (const arma::Mat< eT > &x, arma::Mat< eT > &y)
 Computes the ELU function using a dense matrix as input. More...
 

Private Attributes

double alpha
 ELU Hyperparameter (0 < alpha) More...
 
OutputDataType delta
 Locally-stored delta object. More...
 
InputDataType inputParameter
 Locally-stored input parameter object. More...
 
OutputDataType outputParameter
 Locally-stored output parameter object. More...
 

Detailed Description

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
class mlpack::ann::ELU< InputDataType, OutputDataType >

The ELU activation function, defined by.

\begin{eqnarray*} f(x) &=& \left\{ \begin{array}{lr} x & : x > 0 \\ alpha(e^x - 1) & : x \le 0 \end{array} \right f'(x) &=& \left\{ \begin{array}{lr} 1 & : x > 0 \\ y + alpha & : x \le 0 \end{array} \right \end{eqnarray*}

Template Parameters
InputDataTypeType of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
OutputDataTypeType of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).

Definition at line 61 of file elu.hpp.

Constructor & Destructor Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
mlpack::ann::ELU< InputDataType, OutputDataType >::ELU ( const double  alpha = 1.0)

Create the ELU object using the specified parameters.

The non zero gradient for negative inputs can be adjusted by specifying the ELU hyperparameter alpha (alpha > 0).

Parameters
alphaScale parameter for the negative factor (Default alpha = 1.0).

Member Function Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
double const& mlpack::ann::ELU< InputDataType, OutputDataType >::Alpha ( ) const
inline

Get the non zero gradient.

Definition at line 111 of file elu.hpp.

References mlpack::ann::ELU< InputDataType, OutputDataType >::alpha.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
double& mlpack::ann::ELU< InputDataType, OutputDataType >::Alpha ( )
inline
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename DataType >
void mlpack::ann::ELU< InputDataType, OutputDataType >::Backward ( const DataType &&  input,
DataType &&  gy,
DataType &&  g 
)

Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards through f.

Using the results from the feed forward pass.

Parameters
inputThe propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType const& mlpack::ann::ELU< InputDataType, OutputDataType >::Delta ( ) const
inline

Get the delta.

Definition at line 106 of file elu.hpp.

References mlpack::ann::ELU< InputDataType, OutputDataType >::delta.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::ELU< InputDataType, OutputDataType >::Delta ( )
inline

Modify the delta.

Definition at line 108 of file elu.hpp.

References mlpack::ann::ELU< InputDataType, OutputDataType >::delta.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
double mlpack::ann::ELU< InputDataType, OutputDataType >::Deriv ( const double  y)
inlineprivate

Computes the first derivative of the ELU function.

Parameters
xInput data.
Returns
f'(x)

Definition at line 158 of file elu.hpp.

References mlpack::ann::ELU< InputDataType, OutputDataType >::alpha.

Referenced by mlpack::ann::ELU< InputDataType, OutputDataType >::Deriv().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename InputType , typename OutputType >
void mlpack::ann::ELU< InputDataType, OutputDataType >::Deriv ( const InputType &  x,
OutputType &  y 
)
inlineprivate

Computes the first derivative of the ELU function.

Parameters
yInput activations.
xThe resulting derivatives.

Definition at line 171 of file elu.hpp.

References mlpack::ann::ELU< InputDataType, OutputDataType >::Deriv().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
double mlpack::ann::ELU< InputDataType, OutputDataType >::fn ( const double  x)
inlineprivate

Computes the ELU function.

Parameters
xInput data.
Returns
f(x).

Definition at line 128 of file elu.hpp.

References mlpack::ann::ELU< InputDataType, OutputDataType >::alpha.

Referenced by mlpack::ann::ELU< InputDataType, OutputDataType >::fn().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
void mlpack::ann::ELU< InputDataType, OutputDataType >::fn ( const arma::Mat< eT > &  x,
arma::Mat< eT > &  y 
)
inlineprivate

Computes the ELU function using a dense matrix as input.

Parameters
xInput data.
yThe resulting output activation.

Definition at line 142 of file elu.hpp.

References mlpack::ann::ELU< InputDataType, OutputDataType >::fn().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename InputType , typename OutputType >
void mlpack::ann::ELU< InputDataType, OutputDataType >::Forward ( const InputType &&  input,
OutputType &&  output 
)

Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f.

Parameters
inputInput data used for evaluating the specified function.
outputResulting output activation.
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
InputDataType const& mlpack::ann::ELU< InputDataType, OutputDataType >::InputParameter ( ) const
inline

Get the input parameter.

Definition at line 96 of file elu.hpp.

References mlpack::ann::ELU< InputDataType, OutputDataType >::inputParameter.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
InputDataType& mlpack::ann::ELU< InputDataType, OutputDataType >::InputParameter ( )
inline

Modify the input parameter.

Definition at line 98 of file elu.hpp.

References mlpack::ann::ELU< InputDataType, OutputDataType >::inputParameter.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType const& mlpack::ann::ELU< InputDataType, OutputDataType >::OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 101 of file elu.hpp.

References mlpack::ann::ELU< InputDataType, OutputDataType >::outputParameter.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::ELU< InputDataType, OutputDataType >::OutputParameter ( )
inline

Modify the output parameter.

Definition at line 103 of file elu.hpp.

References mlpack::ann::ELU< InputDataType, OutputDataType >::outputParameter.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename Archive >
void mlpack::ann::ELU< InputDataType, OutputDataType >::Serialize ( Archive &  ar,
const unsigned  int 
)

Member Data Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
double mlpack::ann::ELU< InputDataType, OutputDataType >::alpha
private
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType mlpack::ann::ELU< InputDataType, OutputDataType >::delta
private

Locally-stored delta object.

Definition at line 182 of file elu.hpp.

Referenced by mlpack::ann::ELU< InputDataType, OutputDataType >::Delta().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
InputDataType mlpack::ann::ELU< InputDataType, OutputDataType >::inputParameter
private

Locally-stored input parameter object.

Definition at line 185 of file elu.hpp.

Referenced by mlpack::ann::ELU< InputDataType, OutputDataType >::InputParameter().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType mlpack::ann::ELU< InputDataType, OutputDataType >::outputParameter
private

Locally-stored output parameter object.

Definition at line 188 of file elu.hpp.

Referenced by mlpack::ann::ELU< InputDataType, OutputDataType >::OutputParameter().


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