pymc.iter_sample#
- pymc.iter_sample(draws, step, start, trace=None, chain=0, tune=0, model=None, random_seed=None, callback=None)[source]#
Generate a trace on each iteration using the given step method.
Multiple step methods ared supported via compound step methods. Returns the amount of time taken.
- Parameters
- draws
int
The number of samples to draw
- step
function
Step function
- start
dict
Starting point in parameter space (or partial point).
- trace
backend
orlist
This should be a backend instance, or a list of variables to track. If None or a list of variables, the NDArray backend is used.
- chain
int
, optional Chain number used to store sample in backend.
- tune
int
, optional Number of iterations to tune (defaults to 0).
- model
Model
(optionalif
in
with
context
) - random_seed
single
random
seed
, optional - callback
A function which gets called for every sample from the trace of a chain. The function is called with the trace and the current draw and will contain all samples for a single trace. the
draw.chain
argument can be used to determine which of the active chains the sample is drawn from. Sampling can be interrupted by throwing aKeyboardInterrupt
in the callback.
- draws
- Yields
- trace
MultiTrace
Contains all samples up to the current iteration
- trace
Examples
for trace in iter_sample(500, step): ...