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