Skip to content

ExponentialClassFamily: registry integration and runtime introspection #49

@LeonidElkin

Description

@LeonidElkin

ExponentialClassFamily: registry integration and runtime introspection

Task

Integrate ExponentialClassFamily into the existing families infrastructure and make it detectable at runtime.

Requirements

1. Placement and inheritance

  • ExponentialClassFamily must live in the families module.
  • It must inherit from ParametricFamily.
  • It must satisfy the ParametricFamily interface so that any function that expects a ParametricFamily can also accept an ExponentialClassFamily.

2. Registry integration

  • Ensure that instances of ExponentialClassFamily can be created and registered in the existing registry (the same mechanism used for “ordinary” parametric families).
  • The registry should not need a separate code-path just for exponential families:
    • registration should use the same API as for regular ParametricFamily instances,
    • but it should be possible to query whether a family is exponential-class.

3. Runtime introspection

Provide a minimal mechanism to distinguish at runtime whether a given family is:

  • a “generic” parametric family (ParametricFamily without special exponential structure),
  • or an exponential-class family (ExponentialClassFamily).

Possible approaches (choose one and document):

  • add a boolean property is_exponential_family on ParametricFamily, overridden to True in ExponentialClassFamily;
  • rely on isinstance(family, ExponentialClassFamily) checks;
  • or a small registry of exponential families.

The chosen approach should:

  • be simple to use in downstream code (e.g. Bayesian utilities),
  • avoid breaking existing code that only knows about ParametricFamily.

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions