bayesbay.perturbations.Perturbation

class bayesbay.perturbations.Perturbation

Base class for a perturbation callable

Its subclasses represent different types of perturbations. The core functions of each subclass are perturb() and log_prior_ratio() and are to be called by bayesbay.BaseMarkovChain.advance_chain() on each iteration.

Users don’t instantiate these perturbation classes directly; the instances are generated by bayesbay.parameterization.Parameterization and bayesbay.LogLikelihood instead.

Reference Details

type

type of current perturbation (i.e. class name)

Returns:

the name of this current class

Return type:

str

abstractmethod perturb(state)

proposes a new state from the given state and calculates the log of the corresponding partial acceptance probability

\[\begin{split}\underbrace{\alpha_{p}}_{\begin{array}{c} \text{Partial} \\ \text{acceptance} \\ \text{probability} \end{array}} = \underbrace{\frac{p\left({\bf m'}\right)}{p\left({\bf m}\right)}}_{\text{Prior ratio}} \underbrace{\frac{q\left({\bf m} \mid {\bf m'}\right)}{q\left({\bf m'} \mid {\bf m}\right)}}_{\text{Proposal ratio}} \underbrace{\lvert \mathbf{J} \rvert}_{\begin{array}{c} \text{Jacobian} \\ \text{determinant} \end{array}}\end{split}\]

where \({\bf d}_{obs}\) denotes the observed data and \(\mathbf{J}\) the Jacobian of the transformation.

Parameters:

state (State) – the given current state

Returns:

the proposed new state and \(\alpha_{p} = \log( \frac{p({\bf m'})}{p({\bf m})} \frac{q\left({\bf m} \mid {\bf m'}\right)}{q\left({\bf m'} \mid {\bf m}\right)} \lvert \mathbf{J} \rvert)\)

Return type:

Tuple[State, Number]

__call__(state)

same as perturb()

Parameters:

state (State) – the given current state

Returns:

proposed new state and the partial acceptance probability excluding log likelihood ratio for this perturbation

Return type:

Tuple[State, Number]

back to top