1 #ifndef GRAIL_SIGMOID_FUNCTION_H
2 #define GRAIL_SIGMOID_FUNCTION_H
11 template <
typename ContextType>
28 float range,
float slope,
float threshold,
float displacement)
29 :
Curve<ContextType>{childEvaluator},
30 range(range), slope(slope), threshold(threshold), displacement(displacement)
34 virtual float Sample(
float argument)
const override final
36 float x = slope * (argument - threshold);
39 float exp_x = std::exp(x);
40 return ((range * exp_x) / (1 + exp_x)) + displacement;
44 return (range / (1 + std::exp(-x))) + displacement;
69 EvaluatorType GetEvaluatorType() const override final {
return EvaluatorType::CURVE_SIGMOID; }
74 float threshold = 0.0f;
75 float displacement = 0.0f;
The Curve class - Defines objects transforming one value into the other.
Definition: Curve.hh:21
The SigmoidFunction class - Sigmoid function.
Definition: SigmoidFunction.hh:17
float GetDisplacement() const
GetDisplacement.
Definition: SigmoidFunction.hh:67
float GetRange() const
GetRange.
Definition: SigmoidFunction.hh:52
float GetThreshold() const
GetThreshold.
Definition: SigmoidFunction.hh:62
virtual float Sample(float argument) const override final
Sample - Transforms argument into output value depending on the type of Curve.
Definition: SigmoidFunction.hh:34
float GetSlope() const
GetSlope.
Definition: SigmoidFunction.hh:57
SigmoidFunction(std::shared_ptr< utility::Evaluator< ContextType >> childEvaluator, float range, float slope, float threshold, float displacement)
SigmoidFunction - Constructor.
Definition: SigmoidFunction.hh:27
The Evaluator class - base class being able to evaluate given context and output the result.
Definition: Evaluator.hh:21