Posterior module¶
Definition of the posterior distribution
-
class
svb.posterior.
FactorisedPosterior
(posts, **kwargs)[source]¶ Posterior distribution for a set of parameters with no covariance
-
entropy
(_samples=None)[source]¶ Parameters: samples – A tensor of shape [W, P, S] where W is the number of parameter vertices, P is the number of parameters in the prior (possibly 1) and S is the number of samples. This parameter may or may not be used in the calculation. If it is required, the implementation class must check that it is provided :return Tensor of shape [W] containing vertexwise distribution entropy
-
latent_loss
(prior)[source]¶ Analytic expression for latent loss which can be used when posterior and prior are Gaussian
https://en.wikipedia.org/wiki/Multivariate_normal_distribution#Kullback%E2%80%93Leibler_divergence
Parameters: prior – Vertexwise Prior instance which defines the mean
andcov
vertices attributes
-
sample
(nsamples)[source]¶ Parameters: nsamples – Number of samples to return per parameter vertex / parameter Returns: A tensor of shape [W, P, S] where W is the number of parameter vertices, P is the number of parameters in the distribution (possibly 1) and S is the number of samples
-
-
class
svb.posterior.
GaussianGlobalPosterior
(idx, mean, var, **kwargs)[source]¶ Posterior which has the same value at every parameter vertex
-
entropy
(_samples=None)[source]¶ Parameters: samples – A tensor of shape [W, P, S] where W is the number of parameter vertices, P is the number of parameters in the prior (possibly 1) and S is the number of samples. This parameter may or may not be used in the calculation. If it is required, the implementation class must check that it is provided :return Tensor of shape [W] containing vertexwise distribution entropy
-
-
class
svb.posterior.
MVNPosterior
(posts, **kwargs)[source]¶ Multivariate Normal posterior distribution
-
entropy
(_samples=None)[source]¶ Parameters: samples – A tensor of shape [W, P, S] where W is the number of parameter vertices, P is the number of parameters in the prior (possibly 1) and S is the number of samples. This parameter may or may not be used in the calculation. If it is required, the implementation class must check that it is provided :return Tensor of shape [W] containing vertexwise distribution entropy
-
log_det_cov
()[source]¶ Determinant of a matrix can be calculated from the Cholesky decomposition which may be faster and more stable than tf.matrix_determinant
-
sample
(nsamples)[source]¶ Parameters: nsamples – Number of samples to return per parameter vertex / parameter Returns: A tensor of shape [W, P, S] where W is the number of parameter vertices, P is the number of parameters in the distribution (possibly 1) and S is the number of samples
-
-
class
svb.posterior.
NormalPosterior
(idx, mean, var, **kwargs)[source]¶ Posterior distribution for a single vertexwise parameter with a normal distribution
-
entropy
(_samples=None)[source]¶ Parameters: samples – A tensor of shape [W, P, S] where W is the number of parameter vertices, P is the number of parameters in the prior (possibly 1) and S is the number of samples. This parameter may or may not be used in the calculation. If it is required, the implementation class must check that it is provided :return Tensor of shape [W] containing vertexwise distribution entropy
-
sample
(nsamples)[source]¶ Parameters: nsamples – Number of samples to return per parameter vertex / parameter Returns: A tensor of shape [W, P, S] where W is the number of parameter vertices, P is the number of parameters in the distribution (possibly 1) and S is the number of samples
-
-
class
svb.posterior.
Posterior
(idx, **kwargs)[source]¶ Posterior distribution
-
entropy
(samples=None)[source]¶ Parameters: samples – A tensor of shape [W, P, S] where W is the number of parameter vertices, P is the number of parameters in the prior (possibly 1) and S is the number of samples. This parameter may or may not be used in the calculation. If it is required, the implementation class must check that it is provided :return Tensor of shape [W] containing vertexwise distribution entropy
-
sample
(nsamples)[source]¶ Parameters: nsamples – Number of samples to return per parameter vertex / parameter Returns: A tensor of shape [W, P, S] where W is the number of parameter vertices, P is the number of parameters in the distribution (possibly 1) and S is the number of samples
-