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.
static double Fn(const eT x)
Computes the logistic function.
static void Inv(const InputVecType &y, OutputVecType &x)
Computes the inverse of the logistic function.
The core includes that mlpack expects; standard C++ includes and Armadillo.
static void Fn(const InputVecType &x, OutputVecType &y)
Computes the logistic function.
static void Deriv(const InputVecType &y, OutputVecType &x)
Computes the first derivatives of the logistic function.
static double Deriv(const double x)
Computes the first derivative of the logistic function.
static double Inv(const double y)
Computes the inverse of the logistic function.
The logistic function, defined by.