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 y)
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));