12 #ifndef MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_LOGISTIC_FUNCTION_HPP 13 #define MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_LOGISTIC_FUNCTION_HPP 39 static double Fn(
const eT x)
41 if (x < arma::Datum<eT>::log_max)
43 if (x > -arma::Datum<eT>::log_max)
44 return 1.0 / (1.0 + std::exp(-x));
58 template<
typename InputVecType,
typename OutputVecType>
59 static void Fn(
const InputVecType& x, OutputVecType& y)
61 y = (1.0 / (1 + arma::exp(-x)));
70 static double Deriv(
const double x)
81 template<
typename InputVecType,
typename OutputVecType>
82 static void Deriv(
const InputVecType& y, OutputVecType& x)
93 static double Inv(
const double y)
95 return arma::trunc_log(y / (1 - y));
104 template<
typename InputVecType,
typename OutputVecType>
105 static void Inv(
const InputVecType& y, OutputVecType& x)
107 x = arma::trunc_log(y / (1 - y));
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.
static void Deriv(const InputVecType &y, OutputVecType &x)
Computes the first derivatives of the logistic function.
Definition: logistic_function.hpp:82
static double Deriv(const double x)
Computes the first derivative of the logistic function.
Definition: logistic_function.hpp:70
static void Inv(const InputVecType &y, OutputVecType &x)
Computes the inverse of the logistic function.
Definition: logistic_function.hpp:105
The logistic function, defined by.
Definition: logistic_function.hpp:29
static double Fn(const eT x)
Computes the logistic function.
Definition: logistic_function.hpp:39
static void Fn(const InputVecType &x, OutputVecType &y)
Computes the logistic function.
Definition: logistic_function.hpp:59
static double Inv(const double y)
Computes the inverse of the logistic function.
Definition: logistic_function.hpp:93