public interface RandomVariableDifferentiableInterface extends RandomVariableInterface
RandomVariableInterface
allowing automatic differentiation.
The interface will introduce three additional methods:
Long getID()
and
Map<Long, RandomVariableInterface> getGradient()
and
Map<Long, RandomVariableInterface> getTangents()
.
The method getGradient
will return a map providing the first order
differentiation of the given random variable (this) with respect to
all its input RandomVariableDifferentiableInterface
s.
The method getTangents
will return a map providing the first order
differentiation of all dependent random variables with respect to the
given random variable (this).
To get the differentiation dY/dX of Y with respect to a specific object X using backward mode (getGradient) use
Map gradient = Y.getGradient();
RandomVariableInterface derivative = Y.get(X.getID());
To get the differentiation dY/dX of Y with respect to a specific object X using forward mode (getTanget) use
Map tangent = X.getTangent();
RandomVariableInterface derivative = X.get(Y.getID());
Note: Some implementations may allow limit the result of the gradient to leave nodes or the result of the tangent to terminal nodes.Modifier and Type | Method and Description |
---|---|
default RandomVariableDifferentiableInterface |
getCloneIndependent()
Returns a clone of this differentiable random variable with a new ID.
|
default Map<Long,RandomVariableInterface> |
getGradient()
Returns the gradient of this random variable with respect to all its leaf nodes.
|
Map<Long,RandomVariableInterface> |
getGradient(Set<Long> independentIDs)
Returns the gradient of this random variable with respect to the given IDs.
|
Long |
getID()
A unique id for this random variable.
|
default Map<Long,RandomVariableInterface> |
getTangents()
Returns the tangents of this random variable with respect to all its dependent nodes.
|
Map<Long,RandomVariableInterface> |
getTangents(Set<Long> dependentIDs)
Returns the tangents of this random variable with respect to the given dependent node IDs (if dependent).
|
abs, accrue, add, add, addProduct, addProduct, addRatio, addSumProduct, apply, apply, apply, average, barrier, barrier, bus, cache, cap, cap, choose, cos, discount, div, div, doubleValue, equals, exp, floor, floor, get, getAverage, getAverage, getConditionalExpectation, getFiltrationTime, getHistogram, getHistogram, getMax, getMin, getOperator, getQuantile, getQuantile, getQuantileExpectation, getRealizations, getRealizationsStream, getSampleVariance, getStandardDeviation, getStandardDeviation, getStandardError, getStandardError, getTypePriority, getValues, getVariance, getVariance, invert, isDeterministic, isNaN, log, mult, mult, pow, sin, size, sqrt, squared, sub, sub, subRatio, vid
Long getID()
getGradient
.default Map<Long,RandomVariableInterface> getGradient()
this
.Map<Long,RandomVariableInterface> getGradient(Set<Long> independentIDs)
this
.independentIDs
- Set
of IDs of random variables \( v \) with respect to which the gradients \( \frac{d u}{d v} \) will be calculated. If null, derivatives w.r.t. all known independents are returned.default Map<Long,RandomVariableInterface> getTangents()
this
.Map<Long,RandomVariableInterface> getTangents(Set<Long> dependentIDs)
this
.dependentIDs
- Set
of IDs of random variables \( u \) with respect to which the differentials \( \frac{d u}{d v} \) will be calculated.
If null, derivatives w.r.t. all known dependents are returned.default RandomVariableDifferentiableInterface getCloneIndependent()
Copyright © 2018. All rights reserved.