gaussian_mixture
likelihood¶
A simple (multimodal if required) Gaussian mixture likelihood. The pdf is normalized to 1 when integrated over an infinite domain, regardless of the number of modes.
Usage¶
The mean and covariance matrix for one or more modes must be specified with the options means
and covmats
respectively. The dimensionality of the likelihood and the number of modes are guessed from this options (if they are consistent to each other).
The following example defines 3 modes in 2 dimensions, and expects two parameters whose
names start with test_
and must be defined in the params
block:
likelihood:
gaussian_mixture:
input_params_prefix: test_
means: [ [0.1,0.1],
[0.3,0.3],
[0.4,0.5] ]
covs: [ [[0.01, 0],
[0, 0.05]],
[[0.02, 0.003],
[0.003, 0.01]],
[[0.01, 0],
[0, 0.01]] ]
The option input_params_prefix
fixes the parameters that will be understood by this likelihood: it is a special kind of likelihood that can have any number of nonpredefined parameters, as long as they start with this prefix. If this prefix is not defined (or defined to an empty string), the likelihood will understand all parameter as theirs. The number of parameters taken as input must match the dimensionality defined by the means and covariance matrices.
Derived parameters can be tracked, as many as sampled parameters times the number of modes,
and they represent the standardized parameters of each of the modes, i.e. those distributed
as \(\mathcal{N}(0,I)\) around each mode (notice that if a mode is close to the
boundary of the prior, you should not expect to recover a unit covariance matrix from the
sample). To track them, add the option derived: True, and they will be identified by a prefix defined by output_params_prefix
.
A delay (in seconds) in the likelihood evaluation can be specified with the keyword
delay
.
Note
This module also provides functions to generate random means and covariances – see automatic documentation below.
The default option values for this likelihood are
# Gaussian mixtures likelihood, normalized
# Means and covmats
means:
covs:
# Weights of the components (default: equal weights)
weights:
# Prefix of parameters names
input_params_prefix: ""
output_params_prefix: ""
# Use derived standardized parameters for each component
derived: False
# Delay in likelihood evaluation
delay: 0 # seconds
Gaussian mixture likelihood class¶
Synopsis:  Gaussian mixture likelihood 

Author:  Jesus Torrado 

likelihoods.gaussian_mixture.
gaussian_mixture
¶
Generating random means and covariance matrices¶

likelihoods.gaussian_mixture.
random_mean
(ranges, n_modes=1, mpi_warn=True, random_state=None)¶ Returns a uniformly sampled point (as an array) within a list of bounds
ranges
.The output of this function can be used directly as the value of the option
mean
of thelikelihoods.gaussian
.If
n_modes>1
, returns an array of such points.

likelihoods.gaussian_mixture.
random_cov
(ranges, O_std_min=0.01, O_std_max=1, n_modes=1, mpi_warn=True, random_state=None)¶ Returns a random covariance matrix, with standard deviations sampled loguniformly from the length of the parameter ranges times
O_std_min
andO_std_max
, and uniformly sampled correlation coefficients betweenrho_min
andrho_max
.The output of this function can be used directly as the value of the option
cov
of thelikelihoods.gaussian
.If
n_modes>1
, returns a list of such matrices.

likelihoods.gaussian_mixture.
info_random_gaussian_mixture
(ranges, n_modes=1, input_params_prefix='', output_params_prefix='', O_std_min=0.01, O_std_max=1, derived=False, mpi_aware=True, random_state=None)¶ Wrapper around
random_mean
andrandom_cov
to generate the likelihood and parameter info for a random Gaussian.If
mpi_aware=True
, it draws the random stuff only once, and communicates it to the rest of the MPI processes.