samsam.covis#
- samsam.covis(mu, cov, logprob, nsamples=100000, print_level=1, print_interval=1000, print_inplace=True, **kwargs)#
Importance sampling using a multivariate normal sampling distribution.
The covis sampler generates samples from a normal distribution with mean mu and covariance cov. For each sample, the target distribution logprob is evaluated and a weight is deduced which allows to estimate integrals over the target distribution (e.g. the evidence). The parameters mu and cov should be chosen such that the sampling distribution is close to the target distribution.
- Parameters:
- mu(ndim,) ndarray
Mean of the sampling distribution.
- cov(ndim, ndim) ndarray
Covariacne of the sampling distribution
- logprob(x, **kwargs)function
Log probability of the distribution to sample.
- nsamples: int
Number of samples to draw.
- print_levelint
0 (no printing) 1 (print step)
- print_intervalint
Interval at which to print infos.
- print_inplacebool
Whether to print infos in place or one line after the other.
- **kwargs
Additional parameters for the logprob function.
- Returns:
- samples(nsamples, ndim) ndarray
Array of parameters values for each sample.
- logweights(nsamples,) ndarray
Array of samples log weight.
- diagnositicsdict
Dictionary of diagnostics, with the following keys:
- logsamp(nsamples,) ndarray
Array of log probability of each sample for the sampling distribution.
- logprob(nsamples,) ndarray
Array of log probability of each sample for the target distribution.
- logevidencefloat
Log evidence of the target distribution.