A data structure representing one parameter in a chain of posterior samples.
The Posterior class generates instances of this class for pivoting onto a given parameter (the Posterior class is per-Sampler oriented whereas this class represents the same one parameter in successive samples in the chain).
Definition at line 669 of file bayespputils.py.
Inherits object.
Public Member Functions | |
def | __init__ (self, name, posterior_samples, injected_value=None, injFref=None, trigger_values=None, prior=None) |
Create an instance of PosteriorOneDPDF based on a table of posterior_samples. More... | |
def | __len__ (self) |
Container method. More... | |
def | __getitem__ (self, idx) |
Container method . More... | |
def | name (self) |
Return the string literal name of the parameter. More... | |
def | mean (self) |
Return the arithmetic mean for the marginal PDF on the parameter. More... | |
def | median (self) |
Return the median value for the marginal PDF on the parameter. More... | |
def | stdev (self) |
Return the standard deviation of the marginal PDF on the parameter. More... | |
def | stacc (self) |
Return the 'standard accuracy statistic' (stacc) of the marginal posterior of the parameter. More... | |
def | injval (self) |
Return the injected value set at construction . More... | |
def | trigvals (self) |
Return the trigger values set at construction. More... | |
def | set_injval (self, new_injval) |
Set the injected/real value of the parameter. More... | |
def | set_trigvals (self, new_trigvals) |
Set the trigger values of the parameter. More... | |
def | samples (self) |
Return a 1D numpy.array of the samples. More... | |
def | delete_samples_by_idx (self, samples) |
Remove samples from posterior, analagous to numpy.delete but opperates in place. More... | |
def | gaussian_kde (self) |
Return a SciPy gaussian_kde (representing a Gaussian KDE) of the samples. More... | |
def | KL (self) |
Returns the KL divergence between the prior and the posterior. More... | |
def | prob_interval (self, intervals) |
Evaluate probability intervals. More... | |
def lalinference.bayespputils.PosteriorOneDPDF.__init__ | ( | self, | |
name, | |||
posterior_samples, | |||
injected_value = None , |
|||
injFref = None , |
|||
trigger_values = None , |
|||
prior = None |
|||
) |
Create an instance of PosteriorOneDPDF based on a table of posterior_samples.
name | A literal string name for the parameter. |
posterior_samples | A 1D array of the samples. |
injected_value | The injected or real value of the parameter. |
injFref | reference frequency for injection |
trigger_values | The trigger values of the parameter (dictionary w/ IFOs as keys). |
prior | The prior value corresponding to each sample. |
Definition at line 680 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.__len__ | ( | self | ) |
def lalinference.bayespputils.PosteriorOneDPDF.__getitem__ | ( | self, | |
idx | |||
) |
Container method .
Returns posterior containing sample idx (allows slicing).
Definition at line 700 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.name | ( | self | ) |
Return the string literal name of the parameter.
Definition at line 708 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.mean | ( | self | ) |
Return the arithmetic mean for the marginal PDF on the parameter.
Definition at line 716 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.median | ( | self | ) |
Return the median value for the marginal PDF on the parameter.
Definition at line 724 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.stdev | ( | self | ) |
Return the standard deviation of the marginal PDF on the parameter.
Definition at line 732 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.stacc | ( | self | ) |
Return the 'standard accuracy statistic' (stacc) of the marginal posterior of the parameter.
stacc is a standard deviant incorporating information about the accuracy of the waveform recovery. Defined as the mean of the sum of the squared differences between the points in the PDF (x_i - sampled according to the posterior) and the true value ( \(x_{true}\)). So for a marginalized one-dimensional PDF: \(stacc = \sqrt{\frac{1}{N}\sum_{i=1}^N (x_i-x_{\rm true})2}\)
Definition at line 755 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.injval | ( | self | ) |
Return the injected value set at construction .
If no value was set will return None .
Definition at line 767 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.trigvals | ( | self | ) |
Return the trigger values set at construction.
If no value was set will return None .
Definition at line 776 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.set_injval | ( | self, | |
new_injval | |||
) |
Set the injected/real value of the parameter.
new_injval | The injected/real value to set. |
Definition at line 785 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.set_trigvals | ( | self, | |
new_trigvals | |||
) |
Set the trigger values of the parameter.
new_trigvals | Dictionary containing trigger values with IFO keys. |
Definition at line 794 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.samples | ( | self | ) |
Return a 1D numpy.array of the samples.
Definition at line 803 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.delete_samples_by_idx | ( | self, | |
samples | |||
) |
Remove samples from posterior, analagous to numpy.delete but opperates in place.
samples | A list containing the indexes of the samples to be removed. |
Definition at line 811 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.gaussian_kde | ( | self | ) |
Return a SciPy gaussian_kde (representing a Gaussian KDE) of the samples.
Definition at line 819 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.KL | ( | self | ) |
Returns the KL divergence between the prior and the posterior.
It measures the relative information content in nats. The prior is evaluated at run time. It defaults to None. If None is passed, it just returns the information content of the posterior."
Definition at line 841 of file bayespputils.py.
def lalinference.bayespputils.PosteriorOneDPDF.prob_interval | ( | self, | |
intervals | |||
) |
Evaluate probability intervals.
intervals | A list of the probability intervals [0-1] |
Definition at line 874 of file bayespputils.py.