Curve
A curve is a mathematical function transforming one value into another one. Grail’s curves operate on floating point numbers (R→R). They are often used in Grail’s utility evaluators.
A user can inherit from Curve class to create their own custom curves or they can make use of Grail’s built-in curve types.
Basic Curves
Let’s assume that x means input value.
Step Function
-
threshold -
beforeThresholdValue -
afterThresholdValue
This function returns afterThresholdValue if x is greater than threshold.
Otherwise returns beforeThresholdValue.
Linear Function
-
slope -
intercept
This functions returns result of operation slope * x + intercept.
Power Function
-
exponent -
slope -
intercept
This function takes linear function and raises it to power determined by exponent
The result of linear function slope * x + intercept is lowerbound by 0.
Sigmoid Function
-
slope -
threshold
Work in progress. One day it will become a properly working sigmoid function.
Bounded Curves
Lowerbound
Lowerbound curves cannot return result lesser than their lowerValue.
-
C++
-
C#
auto lowerbound = LowerBound<LinearFunction>{lowerValue, gradient, intercept};
Curve linearCurve = new LinearFunction(gradient, intercept);
LowerBound lowerbound = new LowerBound(linearCurve, lowerValue);
Upperbound
Upperbound curves cannot return result greater than their upperValue.
-
C++
-
C#
auto upperbound = UpperBound<LinearFunction>{upperValue, gradient, intercept};
Curve linearCurve = new LinearFunctiongradient, intercept);
UpperBound upperbound = new UpperBound(linearCurve, upperValue);
Double-Bounded
Double-bounded curves cannot return results lesser than lowerValue or greater than upperValue.
-
C++
-
C#
auto doubleBounded = BoundedCurve<LinearFunction>{lowerValue, upperValue, gradient, intercept};
Curve linearCurve = new LinearFunction(gradient, intercept);
BoundedCurve doubleBounded = new BoundedCurve(linearCurve, lowerValue, upperValue);