tanh_exponential_function.hpp
Go to the documentation of this file.
1 
26 #ifndef MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_TANH_EXPONENTIAL_FUNCTION_HPP
27 #define MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_TANH_EXPONENTIAL_FUNCTION_HPP
28 
29 #include <mlpack/prereqs.hpp>
30 
31 namespace mlpack {
32 namespace ann {
33 
43 {
44  public:
51  static double Fn(const double x)
52  {
53  return x * std::tanh(std::exp(x));
54  }
55 
62  template<typename InputVecType, typename OutputVecType>
63  static void Fn(const InputVecType& x, OutputVecType& y)
64  {
65  y = x % arma::tanh(arma::exp(x));
66  }
67 
74  static double Deriv(const double y)
75  {
76  return std::tanh(std::exp(y)) - y * std::exp(y) *
77  (std::pow(std::tanh(std::exp(y)), 2) - 1);
78  }
79 
86  template<typename InputVecType, typename OutputVecType>
87  static void Deriv(const InputVecType& y, OutputVecType& x)
88  {
89  x = arma::tanh(arma::exp(y)) - y % arma::exp(y) %
90  (arma::pow(arma::tanh(arma::exp(y)), 2) - 1);
91  }
92 }; // class TanhExpFunction
93 
94 } // namespace ann
95 } // namespace mlpack
96 
97 #endif
static void Deriv(const InputVecType &y, OutputVecType &x)
Computes the first derivatives of the tanh function.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
The TanhExp function, defined by.
static void Fn(const InputVecType &x, OutputVecType &y)
Computes the TanhExp function.
static double Deriv(const double y)
Computes the first derivative of the TanhExp function.
static double Fn(const double x)
Computes the TanhExp function.