Skip to content

Distribution


abstract class Distribution<Value> < DelayDistribution

Distribution with delayed-sampling support.

  • Value: Value type.

Member Variables

Name Description
v:Random<Value>? Random variate associated with the distibution, if any.
clamped:Value? Clamped value, if any. See also: clamp().

Member Functions

Name Description
rows Number of rows, when interpreted as a matrix.
columns Number of columns, when interpreted as a matrix.
supportsLazy Are lazy operations supported?
distribution Returns this; a convenience for code generation within the compiler.
setRandom Set a random variate associated with the distribution.
unsetRandom Unset the random variate associated with the distribution.
clamp Clamp value.
hasClamp Is the value clamped?
realize Realize a value for the associated random variate.
get Realize a value for the associated random variate, lazily.
value Realize a value for the associated random variate, eagerly.
observe Observe a value for the associated random variate.
observeLazy Observe a value for the associated random variate, lazily.
simulate Simulate a value.
simulateLazy Simulate a value as part of a lazy expression.
logpdf Evaluate the log probability density (or mass) function.
logpdfLazy Construct a lazy expression for the log probability density (or mass).
update Update the parent node on the M-path given the value of this node.
updateLazy Update the parent node on the M-path given the value of this node.
pdf Evaluate the probability density (or mass) function.
cdf Evaluate the cumulative distribution function at a value.
quantile Evaluate the quantile function at a cumulative probability.
lower Finite lower bound of the support of this node, if any.
upper Finite upper bound of the support of this node, if any.
graftGaussian Graft this onto the delayed sampling graph.
graftBeta Graft this onto the delayed sampling graph.
graftGamma Graft this onto the delayed sampling graph.
graftInverseGamma Graft this onto the delayed sampling graph.
graftInverseWishart Graft this onto the delayed sampling graph.
graftNormalInverseGamma Graft this onto the delayed sampling graph.
graftDirichlet Graft this onto the delayed sampling graph.
graftRestaurant Graft this onto the delayed sampling graph.
graftMultivariateGaussian Graft this onto the delayed sampling graph.
graftMultivariateNormalInverseGamma Graft this onto the delayed sampling graph.
graftMatrixGaussian Graft this onto the delayed sampling graph.
graftMatrixNormalInverseWishart Graft this onto the delayed sampling graph.
graftDiscrete Graft this onto the delayed sampling graph.
graftBoundedDiscrete Graft this onto the delayed sampling graph.

Member Function Details

cdf

function cdf(x:Value) -> Real?

Evaluate the cumulative distribution function at a value.

  • x: The value.

Return: the cumulative probability, if supported.

clamp

function clamp(x:Value)

Clamp value.

  • x: The value.

In the context of delayed sampling, this is used by a node to fix the value of its parent nodes during a call of update(). When those parent nodes are eventually realized, this value will be used.

The typical use case for this is enumerations of random variables, e.g. when a node that represents the sum of two random variables is realized, it fixes the values of two random variables also (its parents).

columns

function columns() -> Integer

Number of columns, when interpreted as a matrix.

distribution

final function distribution() -> Distribution<Value>

Returns this; a convenience for code generation within the compiler.

get

final function get() -> Value

Realize a value for the associated random variate, lazily.

graftBeta

function graftBeta() -> Beta?

Graft this onto the delayed sampling graph.

graftBoundedDiscrete

function graftBoundedDiscrete() -> BoundedDiscrete?

Graft this onto the delayed sampling graph.

graftDirichlet

function graftDirichlet() -> Dirichlet?

Graft this onto the delayed sampling graph.

graftDiscrete

function graftDiscrete() -> Discrete?

Graft this onto the delayed sampling graph.

graftGamma

function graftGamma() -> Gamma?

Graft this onto the delayed sampling graph.

graftGaussian

function graftGaussian() -> Gaussian?

Graft this onto the delayed sampling graph.

graftInverseGamma

function graftInverseGamma() -> InverseGamma?

Graft this onto the delayed sampling graph.

graftInverseWishart

function graftInverseWishart() -> InverseWishart?

Graft this onto the delayed sampling graph.

graftMatrixGaussian

function graftMatrixGaussian() -> MatrixGaussian?

Graft this onto the delayed sampling graph.

graftMatrixNormalInverseWishart

function graftMatrixNormalInverseWishart(compare:Distribution<LLT>) -> MatrixNormalInverseWishart?

Graft this onto the delayed sampling graph.

graftMultivariateGaussian

function graftMultivariateGaussian() -> MultivariateGaussian?

Graft this onto the delayed sampling graph.

graftMultivariateNormalInverseGamma

function graftMultivariateNormalInverseGamma(compare:Distribution<Real>) -> MultivariateNormalInverseGamma?

Graft this onto the delayed sampling graph.

graftNormalInverseGamma

function graftNormalInverseGamma(compare:Distribution<Real>) -> NormalInverseGamma?

Graft this onto the delayed sampling graph.

graftRestaurant

function graftRestaurant() -> Restaurant?

Graft this onto the delayed sampling graph.

hasClamp

function hasClamp() -> Boolean

Is the value clamped?

logpdf

abstract function logpdf(x:Value) -> Real

Evaluate the log probability density (or mass) function.

  • x: The value.

Return: the log probability density (or mass).

logpdfLazy

function logpdfLazy(x:Expression<Value>) -> Expression<Real>?

Construct a lazy expression for the log probability density (or mass).

  • x: The value.

Return: expression giving the log probability density (or mass), if supported.

lower

function lower() -> Value?

Finite lower bound of the support of this node, if any.

observe

final function observe(x:Value) -> Real

Observe a value for the associated random variate.

  • x: The value.

Returns: weight giving the log pdf (or pmf) evaluated at the value.

observeLazy

final function observeLazy(x:Expression<Value>) -> Expression<Real>?

Observe a value for the associated random variate, lazily.

  • x: The value.

Returns: expression giving the log probability density (or mass), if supported.

pdf

function pdf(x:Value) -> Real

Evaluate the probability density (or mass) function.

  • x: The value.

Return: the probability density (or mass).

quantile

function quantile(P:Real) -> Value?

Evaluate the quantile function at a cumulative probability.

  • P: The cumulative probability.

Return: the quantile, if supported.

realize

final function realize()

Realize a value for the associated random variate. If supportsLazy() returns true this defers to get(), otherwise to value().

rows

function rows() -> Integer

Number of rows, when interpreted as a matrix.

setRandom

final function setRandom(v:Random<Value>)

Set a random variate associated with the distribution.

simulate

abstract function simulate() -> Value

Simulate a value.

Return: the value.

simulateLazy

function simulateLazy() -> Value?

Simulate a value as part of a lazy expression.

Return: the value, if supported.

supportsLazy

function supportsLazy() -> Boolean

Are lazy operations supported?

unsetRandom

final function unsetRandom(v:Random<Value>)

Unset the random variate associated with the distribution.

update

function update(x:Value)

Update the parent node on the M-path given the value of this node.

  • x: The value.

updateLazy

function updateLazy(x:Expression<Value>)

Update the parent node on the M-path given the value of this node.

  • x: The value.

upper

function upper() -> Value?

Finite upper bound of the support of this node, if any.

value

final function value() -> Value

Realize a value for the associated random variate, eagerly.