blackjax.mcmc.elliptical_slice#

Public API for the Elliptical Slice sampling Kernel

Module Contents#

Classes#

EllipSliceState

State of the Elliptical Slice sampling algorithm.

EllipSliceInfo

Additional information on the Elliptical Slice sampling chain.

elliptical_slice

Implements the (basic) user interface for the Elliptical Slice sampling kernel.

Functions#

init(position, logdensity_fn)

build_kernel(cov_matrix, mean)

Build an Elliptical Slice sampling kernel [MAM10].

class EllipSliceState[source]#

State of the Elliptical Slice sampling algorithm.

position

Current position of the chain.

logdensity

Current value of the logdensity (evaluated at current position).

position: blackjax.types.ArrayTree[source]#
logdensity: blackjax.types.ArrayTree[source]#
class EllipSliceInfo[source]#

Additional information on the Elliptical Slice sampling chain.

This additional information can be used for debugging or computing diagnostics.

momentum

The latent momentum variable returned at the end of the transition.

theta

A value between [-2pi, 2pi] identifying points in the ellipsis drawn from the positon and mommentum variables. This value indicates the theta value of the accepted proposal.

subiter

Number of sub iterations needed to accept a proposal. The more subiterations needed the less efficient the algorithm will be, and the more dependent the new value is likely to be to the previous value.

momentum: blackjax.types.ArrayTree[source]#
theta: float[source]#
subiter: int[source]#
init(position: blackjax.types.ArrayLikeTree, logdensity_fn: Callable)[source]#
build_kernel(cov_matrix: blackjax.types.Array, mean: blackjax.types.Array)[source]#

Build an Elliptical Slice sampling kernel [MAM10].

Parameters:

cov_matrix – The value of the covariance matrix of the gaussian prior distribution from the posterior we wish to sample.

Returns:

  • A kernel that takes a rng_key and a Pytree that contains the current state

  • of the chain and that returns a new state of the chain along with

  • information about the transition.

class elliptical_slice[source]#

Implements the (basic) user interface for the Elliptical Slice sampling kernel.

Examples

A new Elliptical Slice sampling kernel can be initialized and used with the following code:

ellip_slice = blackjax.elliptical_slice(loglikelihood_fn, cov_matrix)
state = ellip_slice.init(position)
new_state, info = ellip_slice.step(rng_key, state)

We can JIT-compile the step function for better performance

step = jax.jit(ellip_slice.step)
new_state, info = step(rng_key, state)
Parameters:
  • loglikelihood_fn – Only the log likelihood function from the posterior distributon we wish to sample.

  • cov_matrix – The value of the covariance matrix of the gaussian prior distribution from the posterior we wish to sample.

Return type:

A SamplingAlgorithm.

init[source]#
build_kernel[source]#