12#ifndef MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_HARD_SIGMOID_FUNCTION_HPP
13#define MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_HARD_SIGMOID_FUNCTION_HPP
43 static double Fn(
const double x)
45 return std::min(1.0, std::max(0.0, 0.2 * x + 0.5));
54 template<
typename InputVecType,
typename OutputVecType>
55 static void Fn(
const InputVecType& x, OutputVecType& y)
59 for (
size_t i = 0; i < x.n_elem; ++i)
69 static double Deriv(
const double y)
71 if (y == 0.0 || y == 1.0)
84 template<
typename InputVecType,
typename OutputVecType>
85 static void Deriv(
const InputVecType& y, OutputVecType& x)
89 for (
size_t i = 0; i < y.n_elem; ++i)
The hard sigmoid function, defined by.
static double Fn(const double x)
Computes the hard sigmoid function.
static double Deriv(const double y)
Computes the first derivatives of hard sigmoid function.
static void Deriv(const InputVecType &y, OutputVecType &x)
Computes the first derivatives of the hard sigmoid function.
static void Fn(const InputVecType &x, OutputVecType &y)
Computes the hard sigmoid function.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.