public abstract class Function extends java.lang.Object implements java.lang.Cloneable, Storable
NOTE: - subclasses should implement a constructor without parameters, so that Functions can be instantiated by serialization.
| Modifier and Type | Class and Description |
|---|---|
static class |
Function.AboutEqual
About Equal: return 1.0
if (eqValue - range) < value < (eqValue + range). |
static class |
Function.AtLeast
At Least: return 1.0
if value >= minValue, 0.0 else. |
static class |
Function.AtMost
At Most: return 1.0
if value <= maxValue, 0.0 else. |
static class |
Function.CatmullRomSpline
Catmull-Rom Spline Activation Function.
|
static class |
Function.Clip
Clip: return value if value in the given range, else the low/high range border value.
|
static class |
Function.Composition
composition function, returns g(f(x)).
|
static class |
Function.Exponential
The plain exponential function f(x) = e^x with caching.
|
static class |
Function.GreaterThan
Greater Than (strict): return 1.0
if value > minValue, 0.0 else. |
static class |
Function.Identity
identity function - maps input to output
|
static class |
Function.LessThan
Less Than (strict): return 1.0
if value < maxValue, 0.0 else. |
static class |
Function.NaturalSpline
Natural Cubic Spline Activation Function
|
static class |
Function.NotImplemented
Runtime exception to throw for something that is not implemented.
|
static class |
Function.ReLU
The rectified linear unit (ReLU) function f(x) = max(0, x) with first derivative.
|
static class |
Function.Scaled
function adding scaling factors,
applied to the function result value (outside).
|
static class |
Function.Sigmoid
The sigmoid function f(x) = 1 / (1 + e^(-x)) with first and second derivative.
|
static class |
Function.Signum
Signum:
1 if > 0, -1 if < 0, 0 if = 0 |
static class |
Function.SignumWithoutZero
Signum Without Zero: 1
if > 0, -1 else |
static class |
Function.Sinus
Sinus: sin(factor * x)
Default: factor = 0.1
First and Second Derivatives are implemented.
|
static class |
Function.SoftMax
The softmax function mapping an array of values to a probability distribution by f(xi) = e^(xi) / sumi(e^(xi)).
|
static interface |
Function.Spline
Spline function interface.
|
static class |
Function.TanH
The tanh function f(x) = (e^x - e^-x) / (e^x + e^-x) with caching and fast, numerically safe computation.
|
| Constructor and Description |
|---|
Function() |
| Modifier and Type | Method and Description |
|---|---|
Function |
clone()
Return a deep copy of this object.
|
static Function |
create(java.lang.String name)
Create a function, given its name.
|
void |
fromXML(org.jdom2.Element element)
Reads attributes from XML tree.
|
abstract double |
getMaxValue()
Return the largest possible function value.
|
abstract double |
getMinValue()
Return the smallest possible function value.
|
double |
map(double value)
Map a value through the function.
|
double |
mapDerivative(double value)
Map a value through the first derivative of this function.
|
double |
mapSecondDerivative(double value)
Map a value through the second derivative of this function.
|
void |
setParameters(java.lang.Object params)
Set parameters, if needed.
|
org.jdom2.Element |
toXML(org.jdom2.Element element)
Adds a function element to XML.
|
public static Function create(java.lang.String name)
ExceptionHandler.
TODO: handle singleton classes.
name - Name of the function to create.public void setParameters(java.lang.Object params)
params - the parameterspublic double map(double value)
public double mapDerivative(double value)
Function.NotImplemented - if not implemented (this is a RuntimeException).public double mapSecondDerivative(double value)
Function.NotImplemented - if not implemented (this is a RuntimeException).public abstract double getMinValue()
public abstract double getMaxValue()
public Function clone()
clone in class java.lang.ObjectCloneException - if cloning fails internally.public org.jdom2.Element toXML(org.jdom2.Element element)