stheno.random module

class stheno.random.Normal[source]

Bases: stheno.random.RandomVector

Normal random variable.

Parameters
  • mean (column vector, optional) – Mean of the distribution. Defaults to zero.

  • var (matrix) – Variance of the distribution.

property dim

Dimensionality.

property dtype

Data type.

entropy()[source]

Compute the entropy.

Returns

The entropy.

Return type

scalar

kl[source]

Compute the KL divergence with respect to another normal distribution.

Parameters

other (random.Normal) – Other normal.

Returns

KL divergence.

Return type

scalar

lmatmul(other)[source]
logpdf(x)[source]

Compute the log-pdf.

Parameters

x (input) – Values to compute the log-pdf of.

Returns

Log-pdf for every input in x. If it can be

determined that the list contains only a single log-pdf, then the list is flattened to a scalar.

Return type

list[tensor]

property m2

Second moment.

marginal_credible_bounds()[source]

Get the marginal credible region bounds.

Returns

A tuple containing the marginal means and marginal lower and

upper 95% central credible interval bounds.

Return type

tuple

marginals()[source]

Get the marginals.

Returns

A tuple containing the marginal means and marginal variances.

Return type

tuple

property mean

Mean.

property mean_is_zero

The mean is zero.

rmatmul(other)[source]
sample(num=1, noise=None)[source]

Sample from the distribution.

Parameters
  • num (int) – Number of samples.

  • noise (scalar, optional) – Variance of noise to add to the samples. Must be positive.

Returns

Samples as rank 2 column vectors.

Return type

tensor

property var

Variance.

w2[source]

Compute the 2-Wasserstein distance with respect to another normal distribution.

Parameters

other (random.Normal) – Other normal.

Returns

2-Wasserstein distance.

Return type

scalar

class stheno.random.Random[source]

Bases: object

A random object.

class stheno.random.RandomProcess[source]

Bases: stheno.random.Random

A random process.

class stheno.random.RandomVector[source]

Bases: stheno.random.Random

A random vector.