TransportMaps.Samplers¶
Classes
Class  Description 

Sampler  Generic sampler of distribution d 
ImportanceSampler  Importance sampler of distribution d , with biasing distribution d_bias 
RejectionSampler  Rejection sampler of distribution d , with biasing distribution d_bias 
MetropolisHastingsIndependentProposalsSampler  MetropolisHastings with independent proposal sampler of distribution d , with proposal distribution d_prop 
MetropolisHastingsSampler  MetropolisHastings sampler of distribution d , with proposal d_prop 
MetropolisHastingsWithinGibbsSampler  MetropolisHastings within Gibbs sampler of distribution d , with proposal d_prop and Gibbs block sampling blocks 
HamiltonianMonteCarloSampler  Hamiltonian Monte Carlo sampler of distribution d , with proposal distribution d_prop 
Functions
Function  Description 

ess  Compute the Effective Sample Size (ESS) of a sample 
Documentation

class
TransportMaps.Samplers.
Sampler
(d)[source]¶ Generic sampler of distribution
d
This main class just mirrors all the sampling methods provided by the distribution
d
.Parameters: d (Distributions.Distribution) – distribution to sample from.

class
TransportMaps.Samplers.
ImportanceSampler
(d, d_bias)[source]¶ Importance sampler of distribution
d
, with biasing distributiond_bias
Parameters:  d (Distributions.Distribution) – distribution to sample from
 d_bias (Distributions.Distribution) – biasing distribution

class
TransportMaps.Samplers.
RejectionSampler
(d, d_bias)[source]¶ Rejection sampler of distribution
d
, with biasing distributiond_bias
Parameters:  d (Distributions.Distribution) – distribution to sample from
 d_bias (Distributions.Distribution) – biasing distribution

class
TransportMaps.Samplers.
MetropolisHastingsIndependentProposalsSampler
(d, d_prop)[source]¶ MetropolisHastings with independent proposal sampler of distribution
d
, with proposal distributiond_prop
Parameters:  d (Distributions.Distribution) – distribution to sample from
 d_prop (Distributions.Distribution) – proposal distribution

class
TransportMaps.Samplers.
MetropolisHastingsSampler
(d, d_prop)[source]¶ MetropolisHastings sampler of distribution
d
, with proposald_prop
Parameters:  d (Distributions.Distribution) – distribution \(\pi({\bf x})\) to sample from
 d_prop (Distributions.ConditionalDistribution) – conditional distribution \(\pi({\bf y}\vert{\bf x})\) to use as a proposal

class
TransportMaps.Samplers.
MetropolisHastingsWithinGibbsSampler
(d, d_prop_list, block_list=None)[source]¶ MetropolisHastings within Gibbs sampler of distribution
d
, with proposald_prop
and Gibbs block samplingblocks
Parameters:  d (Distributions.Distribution) – distribution \(\pi({\bf x})\) to sample from
 d_prop (
list
ofDistributions.ConditionalDistribution
) – conditional distribution \(\pi({\bf y}\vert{\bf x})\) to use as a proposal  block_list (
list
oflist
) – list of blocks of variables

class
TransportMaps.Samplers.
HamiltonianMonteCarloSampler
(d)[source]¶ Hamiltonian Monte Carlo sampler of distribution
d
, with proposal distributiond_prop
This sampler requires the package pyhmc.
Parameters: d (Distributions.Distribution) – distribution to sample from

TransportMaps.Samplers.
ess
(samps, quantile=0.99, do_xcorr=False, plotting=False, plot_lag=50, fig=None)[source]¶ Compute the Effective Sample Size (ESS) of a sample
The minimum ESS over all the dimension is returned. Crosscorrelation can be optionally used as well in the determination of the ESS. Plotting of the correlation decay can be shown.
The ESS is computed as \(\lfloor m/\kappa \rfloor\), where
\[\kappa = 1 + \sum_{c_i>b_i} c_i \;,\]\(c_i\) is the autocorrelation at lag \(i\) and \(b_i\) is the
quantile
confidence interval for the \(i\)th value of autocorrelation (i.e. only significant autocorrelation values are summed up).Parameters:  samps (
ndarray
[\(m,d\)]) – \(d\)dimensional sample on which to compute the ESS  quantile (float) – condifence interval quantile
 do_xcorr (bool) – whether to compute and use the autocorrelation function
 plotting (bool) – whether to plot auto/crosscorrelation decays
 plot_lag (int) – how many lags to plot
 fig (figure) – handle to a figure
Returns: (
int
) – minimum ESS across the \(d\) dimensions samps (