Skip to content

ExponentialClassFamily: example families and documentation #53

@LeonidElkin

Description

@LeonidElkin

Refactor existing families using ExponentialClassFamily

Task

Refactor existing distribution families so that their exponential-family structure is explicitly represented via ExponentialClassFamily.

The goal is not to introduce new distributions, but to re-implement the already existing ones:

  • Normal
  • ContinuousUniform
  • Exponential

using the ExponentialClassFamily abstraction, ensuring full consistency with their current behavior.

Requirements

1. Re-implementation via ExponentialClassFamily

For each of the following families:

  • Normal distribution
  • ContinuousUniform distribution
  • Exponential distribution

you must:

  • identify and explicitly define the exponential-family components:
    • sufficient statistic T(x),
    • base measure h(x),
    • log-partition function A(θ),
    • natural parameter θ,
    • parameter space constraints;
  • construct a corresponding ExponentialClassFamily instance;
  • integrate it into the existing registry in place of (or alongside, if transitional) the current implementation.

The external behavior of the family must remain unchanged.

2. Behavioral consistency

Ensure that:

  • The pdf / pmf computed through the exponential-family representation matches the current implementation numerically (within tolerance).
  • All characteristics reachable from the family (e.g. mean, var, etc.) behave identically to the previous version.
  • Array semantics and broadcasting behavior remain consistent.

If both implementations temporarily coexist, add tests verifying equivalence.

3. Conjugacy and posterior behavior (where applicable)

For families where conjugate priors are defined:

  • Verify that conjugate prior logic still works correctly.
  • Ensure posterior_hyperparameters behaves as expected (e.g. Normal–Normal, Exponential–Gamma, if applicable).
  • Add regression tests if necessary.

4. Documentation & example notebook

Create a Jupyter notebook demonstrating:

  • How Normal, ContinuousUniform, and Exponential are represented as exponential families via docstrings,
  • The decomposition into T(x), h(x), A(θ),
  • Verification that densities match the original definitions.

Place the notebook under:

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions