Skip to content

Empirical¤

distreqx.distributions.Empirical(distreqx.distributions.AbstractSampleLogProbDistribution) ¤

Empirical distribution over observed samples.

For samples \(x_1, \ldots, x_N\), this represents the discrete measure

\[ P(X = x_i) = \frac{1}{N}. \]

The leading axis of samples indexes observations, the remaining axes are the event shape. atol and rtol define the tolerance used when matching a value to observed samples.

__init__(samples: Array, atol: float = 0.0, rtol: float = 0.0) ¤

Initializes an empirical distribution.

Arguments:

  • samples: Observed values. The first dimension indexes samples.
  • atol: Absolute tolerance for matching values to samples.
  • rtol: Relative tolerance for matching values to samples.

distreqx.distributions.WeightedEmpirical(distreqx.distributions.AbstractSampleLogProbDistribution) ¤

Weighted empirical distribution over observed samples.

For samples \(x_1, \ldots, x_N\) with non-negative weights \(w_1, \ldots, w_N\), this represents the discrete measure

\[ P(X = x_i) = \frac{w_i}{\sum_{j=1}^{N} w_j}. \]

The leading axis of samples indexes observations; the remaining axes are the event shape. atol and rtol define the tolerance used when matching a value to observed samples.

__init__(samples: Array, weights: Array, atol: float = 0.0, rtol: float = 0.0) ¤

Initializes a weighted empirical distribution.

Arguments:

  • samples: Observed values. The first dimension indexes samples.
  • weights: Non-negative sample weights with shape (N,).
  • atol: Absolute tolerance for matching values to samples.
  • rtol: Relative tolerance for matching values to samples.