26 template<
typename AFloat>
30 auto f = [](AFloat) {
return 1.0;};
35 template<
typename AFloat>
38 auto f = [](AFloat
x) {
return (
x < 0.0) ? 0.0 :
x;};
43 template<
typename AFloat>
47 auto f = [](AFloat
x) {
return (
x < 0.0) ? 0.0 : 1.0;};
52 template<
typename AFloat>
55 auto f = [](AFloat
x) {
return 1.0 / (1.0 +
exp(-
x));};
60 template<
typename AFloat>
64 auto f = [](AFloat
x) {
65 AFloat sig = 1.0 / (1.0 +
exp(-
x));
66 return sig * (1.0 - sig);
72 template<
typename AFloat>
75 auto f = [](AFloat
x) {
return tanh(
x);};
80 template<
typename AFloat>
84 auto f = [](AFloat
x) {
92 template<
typename AFloat>
95 auto f = [](AFloat
x) {
return fabs(
x);};
100 template<
typename AFloat>
104 auto f = [](AFloat
x) {
105 return (
x < 0.0) ? -1.0 : 1.0;
111 template<
typename AFloat>
114 auto f = [](AFloat
x) {
return x / (1 +
fabs(
x));};
119 template<
typename AFloat>
123 auto f = [](AFloat
x) {
132 template<
typename AFloat>
135 auto f = [](AFloat
x) {
return exp(-
x *
x);};
140 template<
typename AFloat>
144 auto f = [](AFloat
x) {
return - 2.0 *
x *
exp(-
x *
x);};
static void Sigmoid(TCpuMatrix< Scalar_t > &B)
static void TanhDerivative(TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A)
static void SoftSign(TCpuMatrix< Scalar_t > &B)
static void SymmetricReluDerivative(TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
void MapFrom(Function_t &f, const TCpuMatrix &A)
Same as maps but takes the input values from the matrix A and writes the results in this matrix...
static void ReluDerivative(TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A)
static void SymmetricRelu(TCpuMatrix< Scalar_t > &B)
static void IdentityDerivative(TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A)
static void SoftSignDerivative(TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A)
void Map(Function_t &f)
Map the given function over the matrix elements.
Abstract ClassifierFactory template that handles arbitrary types.
static void Gauss(TCpuMatrix< Scalar_t > &B)
static void Tanh(TCpuMatrix< Scalar_t > &B)
static void Relu(TCpuMatrix< Scalar_t > &B)
static void SigmoidDerivative(TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A)
static void GaussDerivative(TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A)