elliot_function.hpp
Go to the documentation of this file.
1
24 #ifndef MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_ELLIOT_FUNCTION_HPP
25 #define MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_ELLIOT_FUNCTION_HPP
26
27 #include <mlpack/prereqs.hpp>
28
29 namespace mlpack {
30 namespace ann {
31
41 {
42  public:
49  static double Fn(const double x)
50  {
51  return x / (1.0 + std::abs(x));
52  }
53
60  template <typename InputVecType, typename OutputVecType>
61  static void Fn(const InputVecType &x, OutputVecType &y)
62  {
63  y = x / (1.0 + arma::abs(x));
64  }
65
72  static double Deriv(const double y)
73  {
74  return 1.0 / std::pow(1.0 + std::abs(y), 2);
75  }
76
83  template <typename InputVecType, typename OutputVecType>
84  static void Deriv(const InputVecType &y, OutputVecType &x)
85  {
86  x = 1.0 / arma::pow(1.0 + arma::abs(y), 2);
87  }
88 }; // class ElliotFunction
89
90 } // namespace ann
91 } // namespace mlpack
92
93 #endif
static void Fn(const InputVecType &x, OutputVecType &y)
Computes the Elliot function.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
static double Deriv(const double y)
Computes the first derivative of the Elliot function.
The Elliot function, defined by.
static double Fn(const double x)
Computes the Elliot function.
static void Deriv(const InputVecType &y, OutputVecType &x)
Computes the first derivatives of the Elliot function.