class pymc.backends.base.MultiTrace(straces)[source]#

Main interface for accessing values from MCMC results.

The core method to select values is get_values. The method to select sampler statistics is get_sampler_stats. Both kinds of values can also be accessed by indexing the MultiTrace object. Indexing can behave in four ways:

  1. Indexing with a variable or variable name (str) returns all values for that variable, combining values for all chains.

    >>> trace[varname]

    Slicing after the variable name can be used to burn and thin the samples.

    >>> trace[varname, 1000:]

    For convenience during interactive use, values can also be accessed using the variable as an attribute.

    >>> trace.varname
  2. Indexing with an integer returns a dictionary with values for each variable at the given index (corresponding to a single sampling iteration).

  3. Slicing with a range returns a new trace with the number of draws corresponding to the range.

  4. Indexing with the name of a sampler statistic that is not also the name of a variable returns those values from all chains. If there is more than one sampler that provides that statistic, the values are concatenated along a new axis.

For any methods that require a single trace (e.g., taking the length of the MultiTrace instance, which returns the number of draws), the trace with the highest chain number is always used.

nchains: int

Number of chains in the MultiTrace.

chains: `List[int]`

List of chain indices

report: str

Report on the sampling process.

varnames: `List[str]`

List of variable names in the trace(s)



MultiTrace.get_sampler_stats(stat_name[, ...])

Get sampler statistics from the trace.

MultiTrace.get_values(varname[, burn, thin, ...])

Get values from traces.

MultiTrace.point(idx[, chain])

Return a dictionary of point values at idx.


Return an iterator over all or some of the sample points