This class represent a mathematical function used as activation function.
More...
#include <Func.hpp>
|
| Func (const std::function< double(const double)> &func, const std::function< double(const double)> &derivative) |
| The default constructor. More...
|
|
| Func (const Func &func) |
|
double | call (const double input) const |
| Computes the function. More...
|
|
double | derivative (const double input) const |
| Computes the derivative of the function. More...
|
|
This class represent a mathematical function used as activation function.
◆ Func()
sann::math::Func::Func |
( |
const std::function< double(const double)> & |
func, |
|
|
const std::function< double(const double)> & |
derivative |
|
) |
| |
The default constructor.
- Parameters
-
func | - The function. |
derivative | - The derivative of the function. |
◆ call()
double sann::math::Func::call |
( |
const double |
input | ) |
const |
Computes the function.
- Parameters
-
input | - The input of the function. |
- Returns
- double - The computed value.
◆ derivative()
double sann::math::Func::derivative |
( |
const double |
input | ) |
const |
Computes the derivative of the function.
- Parameters
-
input | - The input of the derivative. |
- Returns
- double - The computed derivative.
◆ linear
Func sann::math::Func::linear |
|
static |
Initial value: [](const double x) -> double{
return x;
},
[](const double x) -> double{
return 1;
}
)
Returns the linear function.
- Returns
- Func - The linear function.
◆ ReLU
Func sann::math::Func::ReLU |
|
static |
Initial value: [](const double x) -> double{
return x > 0 ? x : 0;
},
[](const double x) -> double{
return x > 0 ? 1 : 0;
}
)
Returns the relu function.
- Returns
- Func - The relu function.
◆ sigmoid
Func sann::math::Func::sigmoid |
|
static |
Initial value: [](const double x) -> double{
return 1.0 / ( 1.0 + exp( -x ) );
},
[](const double x) -> double{
double ex = exp(x);
return ex / pow(ex + 1, 2);
}
)
Returns the sigmoid function with a slope parameters.
- Parameters
-
slope | - The slope parameters (1 by dafault). |
- Returns
- Func - The sigmoid function.
◆ tanH
Func sann::math::Func::tanH |
|
static |
Initial value: [](const double x) -> double{
return (2 / (1 + exp(-x * 2))) - 1;
},
[](const double x) -> double{
return 1 - pow((2 / (1 + exp(-x * 2))) - 1, 2);
}
)
Returns the tanh function.
- Returns
- Func - The tanh function.
The documentation for this class was generated from the following files: