Skip to content

Random


final class Random<Value> < Expression<Value>

Random variate.

  • Value: Value type.

Random objects, like all Expression objects, are stateful. Random objects in the pilot state are considered variables, meaning that a call to grad() will compute gradients with respect to them, and a further call to move() will apply a Markov kernel to update their value. Random objects in the value state are considered constants.

Assignments

Name Description
Value Value assignment.

Member Variables

Name Description
x:Value? Variate value, once realized.
p:Distribution<Value>? Associated distribution.
d:Value? Accumulated upstream gradient.
flagConstant:Boolean Is this a constant?
gen:Integer Generation label.

Member Functions

Name Description
hasValue Does this have a value?
move Move the value.
assume Assume a distribution for the random variate.
hasGradient Does this have a gradient?
getGradient Get the gradient of an evaluated function with respect to this random variable at its current value.
hasDistribution Does this have a distribution?
getDistribution Get the distribution.

Member Function Details

assume

function assume(p:Distribution<Value>)

Assume a distribution for the random variate. When a value for the random variate is required, it will be simulated from this distribution and trigger an update on the delayed sampling graph.

  • p: The distribution.

getDistribution

function getDistribution() -> Distribution<Value>

Get the distribution.

getGradient

function getGradient() -> Value

Get the gradient of an evaluated function with respect to this random variable at its current value.

hasDistribution

function hasDistribution() -> Boolean

Does this have a distribution?

hasGradient

function hasGradient() -> Boolean

Does this have a gradient?

hasValue

function hasValue() -> Boolean

Does this have a value?

move

function move(x:Value)

Move the value.