bilby.hyper.likelihood.HyperparameterLikelihood

class bilby.hyper.likelihood.HyperparameterLikelihood(posteriors, hyper_prior, sampling_prior=None, log_evidences=None, max_samples=1e+100)[source]

Bases: Likelihood

A likelihood for inferring hyperparameter posterior distributions

See Eq. (34) of https://arxiv.org/abs/1809.02293 for a definition.

Parameters:
posteriors: list

An list of pandas data frames of samples sets of samples. Each set may have a different size.

hyper_prior: `bilby.hyper.model.Model`

The population model, this can alternatively be a function.

sampling_prior: `bilby.hyper.model.Model`

The sampling prior, this can alternatively be a function.

log_evidences: list, optional

Log evidences for single runs to ensure proper normalisation of the hyperparameter likelihood. If not provided, the original evidences will be set to 0. This produces a Bayes factor between the sampling prior and the hyperparameterised model.

max_samples: int, optional

Maximum number of samples to use from each set.

__init__(posteriors, hyper_prior, sampling_prior=None, log_evidences=None, max_samples=1e+100)[source]

Empty likelihood class to be subclassed by other likelihoods

Parameters:
parameters: dict

A dictionary of the parameter names and associated values

__call__(*args, **kwargs)

Call self as a function.

Methods

__init__(posteriors, hyper_prior[, ...])

Empty likelihood class to be subclassed by other likelihoods

log_likelihood()

log_likelihood_ratio()

Difference between log likelihood and noise log likelihood

noise_log_likelihood()

resample_posteriors([max_samples])

Convert list of pandas DataFrame object to dict of arrays.

Attributes

marginalized_parameters

meta_data

log_likelihood()[source]
Returns:
float
log_likelihood_ratio()[source]

Difference between log likelihood and noise log likelihood

Returns:
float
noise_log_likelihood()[source]
Returns:
float
resample_posteriors(max_samples=None)[source]

Convert list of pandas DataFrame object to dict of arrays.

Parameters:
max_samples: int, opt

Maximum number of samples to take from each posterior, default is length of shortest posterior chain.

Returns
=======
data: dict

Dictionary containing arrays of size (n_posteriors, max_samples) There is a key for each shared key in self.posteriors.