7 ExponentialFamily is the abstract base class for probability distributions belonging to an 8 exponential family, whose probability mass/density function has the form is defined below 12 p_{F}(x; \theta) = \exp(\langle t(x), \theta\rangle - F(\theta) + k(x)) 14 where :math:`\theta` denotes the natural parameters, :math:`t(x)` denotes the sufficient statistic, 15 :math:`F(\theta)` is the log normalizer function for a given family and :math:`k(x)` is the carrier 19 This class is an intermediary between the `Distribution` class and distributions which belong 20 to an exponential family mainly to check the correctness of the `.entropy()` and analytic KL 21 divergence methods. We use this class to compute the entropy and KL divergence using the AD 22 framework and Bregman divergences (courtesy of: Frank Nielsen and Richard Nock, Entropies and 23 Cross-entropies of Exponential Families). 27 def _natural_params(self):
29 Abstract method for natural parameters. Returns a tuple of Tensors based 32 raise NotImplementedError
34 def _log_normalizer(self, *natural_params):
36 Abstract method for log normalizer function. Returns a log normalizer based on 37 the distribution and input 39 raise NotImplementedError
42 def _mean_carrier_measure(self):
44 Abstract method for expected carrier measure, which is required for computing 47 raise NotImplementedError
51 Method to compute the entropy using Bregman divergence of the log normalizer. 57 result += lg_normal.clone()
58 for np, g
in zip(nparams, gradients):
def _log_normalizer(self, natural_params)
def _mean_carrier_measure(self)
def grad(outputs, inputs, grad_outputs=None, retain_graph=None, create_graph=False, only_inputs=True, allow_unused=False)
def _natural_params(self)