# ab.distributions¶

Helper functions for model parameter distributions.

aboleth.distributions.gaus_posterior(dim, std0, suffix=None)

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. std0 (float) – the initial (unoptimized) diagonal standard deviation of this distribution. suffix (str) – suffix to add to the names of the variables of the parameters of this distribution. Q – the initialised posterior Gaussian object. tf.contrib.distributions.MultivariateNormalTriL

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 std0 standard deviation, and the initialisation of the (lower triangular of the) covariance is from a gamma distribution with an alpha of std0 and a beta of 1.

aboleth.distributions.kl_sum(q, p)

Compute the total KL between (potentially) many distributions.

I.e. $$\sum_i \text{KL}[q_i || p_i]$$

Parameters: q (tf.distributions.Distribution) – A tensorflow Distribution object p (tf.distributions.Distribution) – A tensorflow Distribution object kl – the result of the sum of the KL divergences of the q and p distibutions. Tensor
aboleth.distributions.norm_posterior(dim, std0, suffix=None)

Initialise a posterior (diagonal) Normal distribution.

Parameters: dim (tuple or list) – the dimension of this distribution. std0 (float) – the initial (unoptimized) standard deviation of this distribution. suffix (str) – suffix to add to the names of the variables of the parameters of this distribution. Q – the initialised posterior Normal object. tf.distributions.Normal

Note

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

aboleth.distributions.norm_prior(dim, std)

Make a prior (zero mean, isotropic) Normal distribution.

Parameters: dim (tuple or list) – the dimension of this distribution. std (float, np.array, tf.Tensor, tf.Variable) – the prior standard deviation of this distribution. P – the initialised prior Normal object. tf.distributions.Normal