Samples#
- class cuqi.samples.Samples(samples, geometry=None, is_par=True, is_vec=True)#
An object used to store samples from distributions.
- Parameters:
samples (ndarray) – Contains the raw samples as a numpy array indexed by the last axis of the array.
geometry (cuqi.geometry.Geometry, default None) – Contains the geometry related of the samples
- __init__(samples, geometry=None, is_par=True, is_vec=True)#
Methods
__init__
(samples[, geometry, is_par, is_vec])burnthin
(Nb[, Nt])Remove burn-in and thin samples.
ci_width
([percent])Compute width of the pointwise credibility intervals of the samples
compute_ci
([percent])Compute pointwise credibility intervals of the samples.
compute_ess
(**kwargs)Compute effective sample size (ESS) of samples.
compute_rhat
(chains, **kwargs)Compute rhat value of samples given list of cuqi.samples.Samples objects (chains) to compare with.
Conducts diagnostics on the chain (Geweke test).
hist_chain
(variable_indices, *args, **kwargs)Plots samples histogram of variables with indices specified in variable_indices.
mean
()Compute mean of the samples.
median
()Compute pointwise median of the samples
plot
([sample_indices])Plots one or more samples.
plot_autocorrelation
([variable_indices, ...])Plot the autocorrelation function of one or more variables in a single chain.
plot_chain
([variable_indices])plot_ci
([percent, exact, plot_envelope_kwargs])Plots the credibility interval for the samples according to the geometry.
plot_ci_width
([percent])Plot width of the pointwise credibility intervals of the samples
plot_mean
(*args, **kwargs)Plot pointwise mean of the samples
plot_median
(*args, **kwargs)Plot pointwise median of the samples
plot_pair
([variable_indices, kind, marginals])Plot marginals using a scatter, kde and/or hexbin matrix.
plot_std
(*args, **kwargs)Plot pointwise standard deviation of the samples
plot_trace
([variable_indices, exact, ...])Creates a traceplot of the samples consisting of 1) a histogram/density plot of the samples and 2) an MCMC chain plot.
plot_variance
(*args, **kwargs)Plot pointwise variance of the samples
plot_violin
([variable_indices])Create a violin plot of the samples.
std
()Compute pointwise standard deviation of the samples
to_arviz_inferencedata
([variable_indices])Return arviz InferenceData object of samples for the given variable indices
variance
()Compute pointwise variance of the samples
Attributes
Return number of samples
Returns a new Samples object of sample function values.
If self.is_par is False, returns a new Samples object of sample parameters by converting the function values to parameters.
Returns the shape of samples.
Returns a new Samples object of samples in vector form.