MomentGauge.Sampler.Base#

Module Contents#

Classes#

BaseSampler

The base class for sampler.

class MomentGauge.Sampler.Base.BaseSampler(constant)#

The base class for sampler. A sampler is a probability distribution \(f(\mathbf{u};\boldsymbol{\beta})\) parametrized by \(\boldsymbol{\beta}\) from which we could draw samples and compute likelihoods.

Parameters:

constant (dictionary) – a dictionary with necessary constants provided as key-value pairs.

constant#

a dictionary with necessary constants provided as key-value pairs.

Type:

dict

abstract sample(betas)#

Generate N samples \(\mathbf{u}_i\) from the distribution \(f(\mathbf{u})\) with proper weights \(w_i\) such that

\begin{equation} \int \phi(\mathbf{u}) f(\mathbf{u}) d \mathbf{u} \approx \sum_{i=1}^N w_i \phi(\mathbf{u}_i), \end{equation}

in whic N depends on the particular implementation of the sampler.

Parameters:

betas (array of shape (n)) – the n-dim parameter \(\boldsymbol{\beta}\) specifying the distributions

Returns:

A tuple containing

samples: array of shape (N,d) - N samples of d-dim vectors \(\mathbf{u}_i\) draw from the distribution.

weights: array of shape (N) - non-negative weights \(w_i\) for each samples. The summation of weights equals to 1.

log_likelihoods: array of shape (N) - the log-likelihoods \(\log f(\mathbf{u}_i)\) for each samples

Return type:

Tuple

Raises:

NotImplementedError – This method is not implemented