Slice Sampler¶

class
sampyl.
Slice
(logp, start, compwise=False, width=1.0, step_out=True, doubling_step=True, max_steps_out=10, verbose=False, **kwargs)¶ Slice sampler (Neal, 2003) for creating a Markov chain that leaves the the distribution defined by logp invariant
 For technical details, see Neal’s paper:
 http://projecteuclid.org/euclid.aos/1056562461
Andrew Miller (acm@seas.harvard.edu) 71315
Adapted from code written by Ryan Adams (rpa@seas.harvard.edu)
Parameters:  logp – function. \(\log{P(X)}\) function for sampling distribution.
 start – scalar or 1D arraylike. Starting state for sampler.
 compwise – (optional) boolean. Componentwise univariate slice sample (or random direction)
 width – (optional) int, float. (Initial) width of the slice
 step_out – (optional) boolean. Perform stepout procedure
 doubling_step – (optional) boolean. If stepping out, double slice width?
 max_steps_out – (optional) int. Max number of steps out to perform
 verbose – (optional) boolean. Print steps out

direction_slice
(direction, init_x)¶ one dimensional directional slice sample along direction specified Implements the stepping out procedure from Neal

sample
(num, burn=0, thin=1, n_chains=1, progress_bar=True)¶ Sample from \(P(X)\)
Parameters:  num – int. Number of samples to draw from \(P(X)\).
 burn – (optional) int. Number of samples to discard from the beginning of the chain.
 thin – (optional) float. Thin the samples by this factor.
 n_chains – (optional) int. Number of chains to return. Each chain is given its own process and the OS decides how to distribute the processes.
 progress_bar – (optional) boolean. Show the progress bar, default = True.
Returns: Record array with fields taken from arguments of logp function.

step
()¶ Perform a slice sample step