Protocols

Cross-cutting capability protocols for exponential families.

These protocols express optional capabilities that cut across the main inheritance hierarchy. They exist because Python lacks intersection types — a class can be both an ExponentialFamily and support StatisticalMoments, but the type system cannot express that constraint directly.

class StatisticalMoments(*args, **kwargs)[source]

Protocol for distributions that can compute statistical moments.

This is a structural type: any class with matching statistical_mean and statistical_covariance methods satisfies it, without explicit inheritance.

statistical_mean(params: Array) Array[source]

Compute the mean of the distribution from its natural parameters.

statistical_covariance(params: Array) Array[source]

Compute the covariance matrix of the distribution from its natural parameters.