mlpack
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.
Definition: lisht_function.hpp:42
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
static void Fn(const InputVecType &x, OutputVecType &y)
Computes the LiSHT function.
Definition: lisht_function.hpp:63
The core includes that mlpack expects; standard C++ includes and Armadillo.
static double Deriv(const double y)
Computes the first derivative of the LiSHT function.
Definition: lisht_function.hpp:74
static double Fn(const double x)
Computes the LiSHT function.
Definition: lisht_function.hpp:51
static void Deriv(const InputVecType &y, OutputVecType &x)
Computes the first derivatives of the LiSHT function.
Definition: lisht_function.hpp:86