ab.distributions¶

Model parameter distributions.

class aboleth.distributions.Gaussian(mu, L)

Gaussian prior/posterior.

Parameters: mu (Tensor) – mean, shape (d_in, d_out) L (Tensor) – Cholesky of the covariance matrix, shape (d_out, d_in, d_in) eps (ndarray, Tensor, optional) – random draw from a unit normal if you want to “fix” the sampling, this should be of shape (d_in, d_out). If this is None then a new random draw is used for every call to sample().
static itransform_w(wt)

Un-transform a weight matrix, (d_out, d_in, 1) -> (d_in, d_out).

sample(e=None)

Draw a random sample from this object.

Parameters: e (ndarray, Tensor, optional) – the random standard-Normal samples to transform to yeild samples from this distrubution. These must be of shape (d_in, ...). If this is none, these are generated in this method. x – a sample of shape (d_in, d_out), or e.shape if provided Tensor
static transform_w(w)

Transform a weight matrix, (d_in, d_out) -> (d_out, d_in, 1).

class aboleth.distributions.Normal(mu=0.0, var=1.0)

Normal (IID) prior/posterior.

Parameters: mu (Tensor) – mean, shape (d_in, d_out) var (Tensor) – variance, shape (d_in, d_out)
sample(e=None)

Draw a random sample from this object.

Parameters: e (ndarray, Tensor, optional) – the random standard-Normal samples to transform to yeild samples from this distrubution. These must be of shape (d_in, ...). If this is none, these are generated in this method. x – a sample of shape (d_in, d_out), or e.shape if provided Tensor
class aboleth.distributions.ParameterDistribution

Bases: object

Abstract base class for parameter distribution objects.

sample()

Draw a random sample from the distribution.

aboleth.distributions.gaus_posterior(dim, var0)

Initialise a posterior Gaussian distribution with a diagonal covariance.

Even though this is initialised with a diagonal covariance, a full covariance will be learned, using a lower triangular Cholesky parameterisation.

Parameters: dim (tuple or list) – the dimension of this distribution. var0 (float) – the initial (unoptimized) diagonal variance of this distribution. Q – the initialised posterior Gaussian object. Gaussian

Note

This will make tf.Variables on the randomly initialised mean and covariance of the posterior. The initialisation of the mean is from a Normal with zero mean, and var0 variance, and the initialisation of the variance is from a gamma distribution with an alpha of var0 and a beta of 1.

aboleth.distributions.norm_posterior(dim, var0)

Initialise a posterior (diagonal) Normal distribution.

Parameters: dim (tuple or list) – the dimension of this distribution. var0 (float) – the initial (unoptimized) variance of this distribution. Q – the initialised posterior Normal object. Normal

Note

This will make tf.Variables on the randomly initialised mean and variance of the posterior. The initialisation of the mean is from a Normal with zero mean, and var0 variance, and the initialisation of the variance is from a gamma distribution with an alpha of var0 and a beta of 1.

aboleth.distributions.norm_prior(dim, var)

Initialise a prior (zero mean, diagonal) Normal distribution.

Parameters: dim (tuple or list) – the dimension of this distribution. var (float) – the prior variance of this distribution. P – the initialised prior Normal object. Normal

Note

This will make a tf.Variable on the variance of the prior that is initialised with var.