Package pylal :: Module bayespputils :: Class PosteriorOneDPDF
[hide private]
[frames] | no frames]

Class PosteriorOneDPDF

source code

object --+
         |
        PosteriorOneDPDF

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).

Instance Methods [hide private]
 
__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.
source code
 
__len__(self)
Container method.
source code
 
__getitem__(self, idx)
Container method .
source code
string
name(self)
Return the string literal name of the parameter.
source code
number
mean(self)
Return the arithmetic mean for the marginal PDF on the parameter.
source code
number
median(self)
Return the median value for the marginal PDF on the parameter.
source code
number
stdev(self)
Return the standard deviation of the marginal PDF on the parameter.
source code
number
stacc(self)
Return the 'standard accuracy statistic' (stacc) of the marginal posterior of the parameter.
source code
undefined
injval(self)
Return the injected value set at construction .
source code
undefined
trigvals(self)
Return the trigger values set at construction.
source code
 
set_injval(self, new_injval)
Set the injected/real value of the parameter.
source code
 
set_trigvals(self, new_trigvals)
Set the trigger values of the parameter.
source code
numpy.array
samples(self)
Return a 1D numpy.array of the samples.
source code
 
delete_samples_by_idx(self, samples)
Remove samples from posterior, analagous to numpy.delete but opperates in place.
source code
scipy.stats.kde.gaussian_kde
gaussian_kde(self)
Return a SciPy gaussian_kde (representing a Gaussian KDE) of the samples.
source code
 
KL(self)
Returns the KL divergence between the prior and the posterior.
source code
 
prob_interval(self, intervals)
Evaluate probability intervals.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, posterior_samples, injected_value=None, injFref=None, trigger_values=None, prior=None)
(Constructor)

source code 

Create an instance of PosteriorOneDPDF based on a table of posterior_samples.

Parameters:
  • name - A literal string name for the parameter.
  • posterior_samples - A 1D array of the samples.
  • injected_value (glue.ligolw.lsctables.SimInspiral) - The injected or real value of the parameter.
  • trigger_values - The trigger values of the parameter (dictionary w/ IFOs as keys).
  • prior - The prior value corresponding to each sample.
Overrides: object.__init__

__len__(self)
(Length operator)

source code 

Container method. Defined as number of samples.

__getitem__(self, idx)
(Indexing operator)

source code 

Container method . Returns posterior containing sample idx (allows slicing).

name(self)

source code 

Return the string literal name of the parameter.

Returns: string
Decorators:
  • @property

mean(self)

source code 

Return the arithmetic mean for the marginal PDF on the parameter.

Returns: number
Decorators:
  • @property

median(self)

source code 

Return the median value for the marginal PDF on the parameter.

Returns: number
Decorators:
  • @property

stdev(self)

source code 

Return the standard deviation of the marginal PDF on the parameter.

Returns: number
Decorators:
  • @property

stacc(self)

source code 

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_{ m true}). So for a marginalized one-dimensional PDF: stacc = \sqrt{ rac{1}{N}\sum_{i=1}^N (x_i-x_{ m true})2}

Returns: number
Decorators:
  • @property

injval(self)

source code 

Return the injected value set at construction . If no value was set will return None .

Returns: undefined
Decorators:
  • @property

trigvals(self)

source code 

Return the trigger values set at construction. If no value was set will return None .

Returns: undefined
Decorators:
  • @property

set_injval(self, new_injval)

source code 

Set the injected/real value of the parameter.

Parameters:
  • new_injval (glue.ligolw.lsctables.SimInspiral) - The injected/real value to set.

set_trigvals(self, new_trigvals)

source code 

Set the trigger values of the parameter.

Parameters:
  • new_trigvals (glue.ligolw.lsctables.SnglInspiral) - Dictionary containing trigger values with IFO keys.

samples(self)

source code 

Return a 1D numpy.array of the samples.

Returns: numpy.array
Decorators:
  • @property

delete_samples_by_idx(self, samples)

source code 

Remove samples from posterior, analagous to numpy.delete but opperates in place.

Parameters:
  • samples (list) - A list containing the indexes of the samples to be removed.

gaussian_kde(self)

source code 

Return a SciPy gaussian_kde (representing a Gaussian KDE) of the samples.

Returns: scipy.stats.kde.gaussian_kde
Decorators:
  • @property

KL(self)

source code 

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."

Decorators:
  • @property

prob_interval(self, intervals)

source code 

Evaluate probability intervals.

Parameters:
  • intervals (list) - A list of the probability intervals [0-1]