the size to expand a slice while taking one step in a single direction from the starting point
the maximum number of steps in either direction while expanding a slice
the random seed
Draws a new point uniformly from the given horizontal slice through the function, along the given direction
Draws a new point uniformly from the given horizontal slice through the function, along the given direction
the original point
the value of the function slice
the log-transformed function from which to sample. Note that this need not sum to 1, and need only be proportional to the target PDF.
the direction along which to draw a new point
the slice bounds
the new point
Draws a new point from the target distribution along the given direction
Draws a new point from the target distribution along the given direction
the original point
the log-transformed function from which to sample. Note that this need not sum to 1, and need only be proportional to the target PDF.
the direction along which to draw a new point
the new point
Draws a new point from the target distribution
Draws a new point from the target distribution
the original point
the log-transformed function from which to sample. Note that this need not sum to 1, and need only be proportional to the target PDF.
the new point
Draws a new point from the target distribution, sampling from each dimension one-by-one
Draws a new point from the target distribution, sampling from each dimension one-by-one
the original point
the log-transformed function from which to sample. Note that this need not sum to 1, and need only be proportional to the target PDF.
the new point
Builds a direction basis vector from the index
Builds a direction basis vector from the index
the active index
size of the vector
the direction basis vector
Shrinks the slice by clamping to the new point x.
Shrinks the slice by clamping to the new point x.
the original slice
the original point x
the new point x
the direction along which to shrink the slice
the shrunken slice
Performs the step out procedure.
Performs the step out procedure. Start at the given x position, and expand outwards along the given direction until the slice extends beyond where the PDF lies above the y value.
the starting point
the value at which the function will be sliced
the log-transformed function from which to sample. Note that this need not sum to 1, and need only be proportional to the target PDF.
the direction along which to slice
the slice lower and upper bounds
This class implements the slice sampling algorithm. Slice sampling is an Markov chain Monte Carlo algorithm for sampling from an arbitrary continuous distribution function.
Consider the ASCII-normal distribution function shown below.
/-\ /-\ f(x) /-\ /-\ /-\ / \ / |\ / |\ / \ / \ / \ / | \ /---|-\ /-x'--\ / \ --/ x \-- --/ x \-- --/ x \-- --/ \-- --/ x' \--
1 2 3 4 5
The procedure for drawing a sample from the function is as follows:
1) Start with an initial point x in the domain (e.g. the sample from a previous iteration). 2) Sample a vertical value uniformly between zero and f(x). 3) Step out horizontally in both directions from the value obtained in step 2 until reaching the boundary of the function. This is the "slice". 4) Sample uniformly from the slice to obtain the new point x'. 5) Back to step 1 with the new point.