nnpd.nre.distributions

Distribution interfaces, independent bounded priors, and exact samplers.

Classes

Parameter

Simulator

Helper class that provides a standard way to create an ABC using

Prior

Helper class that provides a standard way to create an ABC using

IndependentPrior

Uniform, truncated normal, bounded signed exponential, or grid per axis.

Functions

grid_axis(→ numpy.ndarray)

Module Contents

class nnpd.nre.distributions.Parameter
name: str
low: float
high: float
options: dict
nnpd.nre.distributions.grid_axis(low: float, high: float, step: float) → numpy.ndarray
class nnpd.nre.distributions.Simulator

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

parameters: tuple[Parameter, ...]
observation_dim: int
abstractmethod sample(theta: numpy.ndarray, rng: numpy.random.Generator) → numpy.ndarray

One observation per parameter row; result shape (…, observation_dim).

abstractmethod log_likelihood(x: numpy.ndarray, theta: numpy.ndarray) → numpy.ndarray

Optional exact reference, not used by the NRE training objective.

class nnpd.nre.distributions.Prior

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

parameters: tuple[Parameter, ...]
abstractmethod sample(size: int, rng: numpy.random.Generator) → numpy.ndarray

Draw shape (size, number_of_inferred_parameters).

abstractmethod log_prob(theta: numpy.ndarray) → numpy.ndarray

Log density or log mass with respect to the declared support measure.

property support_axes: tuple[numpy.ndarray | None, ...]

None means continuous; an array means discrete counting measure.

property measure: str
class nnpd.nre.distributions.IndependentPrior(parameters: tuple[Parameter, ...], definition: dict)

Bases: Prior

Uniform, truncated normal, bounded signed exponential, or grid per axis.

A negative exponential rate is valid on a finite box; it is not an unbounded exponential distribution. Grid log_prob returns a mass, never a density. ‘by_parameter’ may override the default family for particular coordinates.

families
parameters
kinds
property support_axes

None means continuous; an array means discrete counting measure.

sample(size: int, rng: numpy.random.Generator) → numpy.ndarray

Draw shape (size, number_of_inferred_parameters).

log_prob(theta: numpy.ndarray) → numpy.ndarray

Log density or log mass with respect to the declared support measure.