Prior

phasic.svgd.Prior()

Base class for prior distributions.

Subclasses must implement call (log-probability) and sample methods. The sample method enables SVGD to initialize particles from the prior.

Per-dimension natural transform

Subclasses may set the class attribute _natural_transform (a callable φ → θ) to declare the constraint they want on their own parameter dimension. None (the default) means “use SVGD’s global choice” (typically softplus when positive_params=True). When Graph.svgd(prior=[...]) is called with a list of priors, SVGD assembles a per-dimension composite param_transform using each prior’s natural transform; priors that say None fall back to the global default. Use this to mix positive parameters (Gauss/LogGauss/HalfCauchy → softplus) with probability parameters (:class:BetaPrior → sigmoid) in a single fit.

Methods

Name Description
plot Plot the prior distribution.
sample Sample from the prior distribution.

plot

phasic.svgd.Prior.plot(ax=None, **kwargs)

Plot the prior distribution.

Parameters

ax : matplotlib.axes.Axes = None

Axes to plot on. If None, creates new figure.

****kwargs** : = {}

Additional arguments passed to plot function.

Returns

: matplotlib.axes.Axes

The axes with the plot

sample

phasic.svgd.Prior.sample(key, shape)

Sample from the prior distribution.

Parameters

key : jax.random.PRNGKey

Random key for JAX

shape : tuple

Shape of samples, typically (n_particles, theta_dim)

Returns

: jnp.ndarray

Samples from prior with given shape