Multimodal Gaussian distribution

class pints.toy.MultimodalGaussianLogPDF(modes=None, covariances=None)[source]

Multimodal (un-normalised) multivariate Gaussian distribution.

By default, the distribution is on a 2-dimensional space, with modes at at (0, 0) and (10, 10) with independent unit covariance matrices.

Examples:

# Default 2d, bimodal
f = pints.toy.MultimodalGaussianLogPDF()

# 3d bimodal
f = pints.toy.MultimodalGaussianLogPDF([[0, 1, 2], [10, 10, 10]])

# 2d with 3 modes
f = pints.toy.MultimodalGaussianLogPDF([[0, 0], [5, 5], [5, 0]])

Extends pints.toy.ToyLogPDF.

Parameters:
  • modes – A list of points that will form the modes of the distribution. Must all have the same dimension. If not set, the method will revert to the bimodal distribution described above.
  • covariances – A list of covariance matrices, one for each mode. If not set, a unit matrix will be used for each.
distance(samples)[source]

Calculates per mode approximate KL divergence then sums these.

See pints.toy.ToyLogPDF.distance().

evaluateS1(x)[source]

See LogPDF.evaluateS1().

kl_divergence(samples)[source]

Calculates the approximate Kullback-Leibler divergence between a given list of samples and the distribution underlying this LogPDF. It does this by first assigning each point to its most likely mode then calculating KL for each mode separately. If one mode is found with no near samples then all the samples are used to calculate KL for this mode.

The returned value is (near) zero for perfect sampling, and then increases as the error gets larger.

See: https://en.wikipedia.org/wiki/Kullback-Leibler_divergence

n_parameters()[source]

See pints.LogPDF.n_parameters().

sample(n_samples)[source]

See pints.toy.ToyLogPDF.sample().

suggested_bounds()[source]

See pints.toy.ToyLogPDF.suggested_bounds().