bilby.core.fisher.FisherMatrixPosteriorEstimator
- class bilby.core.fisher.FisherMatrixPosteriorEstimator(likelihood, priors, parameters=None, fd_eps=1e-06, n_prior_samples=100)[source]
Bases:
object
- __init__(likelihood, priors, parameters=None, fd_eps=1e-06, n_prior_samples=100)[source]
A class to estimate posteriors using the Fisher Matrix approach
- Parameters:
- likelihood: bilby.core.likelihood.Likelihood
A bilby likelihood object
- priors: bilby.core.prior.PriorDict
A bilby prior object
- parameters: list
Names of parameters to sample in
- fd_eps: float
A parameter to control the size of perturbation used when finite differencing the likelihood
- n_prior_samples: int
The number of prior samples to draw and use to attempt estimatation of the maximum likelihood sample.
- __call__(*args, **kwargs)
Call self as a function.
Methods
__init__
(likelihood, priors[, parameters, ...])A class to estimate posteriors using the Fisher Matrix approach
calculate_FIM
(sample)calculate_iFIM
(sample)get_finite_difference_xx
(sample, ii)get_finite_difference_xy
(sample, ii, jj)get_maximum_likelihood_sample
([initial_sample])A method to attempt optimization of the maximum likelihood
get_second_order_derivative
(sample, ii, jj)log_likelihood
(sample)sample_array
(sample[, n])sample_dataframe
(sample[, n])shift_sample_x
(sample, x_key, x_coef)shift_sample_xy
(sample, x_key, x_coef, ...)- get_maximum_likelihood_sample(initial_sample=None)[source]
A method to attempt optimization of the maximum likelihood
This uses a simple scipy optimization approach, starting from a number of draws from the prior to avoid problems with local optimization.
Note: this approach works well in small numbers of dimensions when the posterior is narrow relative to the prior. But, if the number of dimensions is large or the posterior is wide relative to the prior, the method fails to find the global maximum in high dimensional problems.