The extropy [LSAgro11] is a dual to the Entropy. It is defined by:

\[\X{X} = -\sum_{x \in X} (1-p(x)) \log_2 (1-p(x))\]

The entropy and the extropy satisify the following relationship:

\[\H{X} + \X{X} = \sum_{x \in \mathcal{X}} \H{p(x), 1-p(x)} = \sum_{x \in \mathcal{X}} \X{p(x), 1-p(x)}\]

Unfortunately, the extropy does not yet have any intuitive interpretation.

In [1]: In [1]: from dit.other import extropy


extropy(dist, rvs=None, rv_mode=None)[source]

Returns the extropy J[X] over the random variables in rvs.

If the distribution represents linear probabilities, then the extropy is calculated with units of ‘bits’ (base-2).

  • dist (Distribution or float) – The distribution from which the extropy is calculated. If a float, then we calculate the binary extropy.

  • rvs (list, None) – The indexes of the random variable used to calculate the extropy. If None, then the extropy is calculated over all random variables. This should remain None for ScalarDistributions.

  • rv_mode (str, None) – Specifies how to interpret the elements of rvs. Valid options are: {‘indices’, ‘names’}. If equal to ‘indices’, then the elements of rvs are interpreted as random variable indices. If equal to ‘names’, the the elements are interpreted as random variable names. If None, then the value of dist._rv_mode is consulted.


J – The extropy of the distribution.

Return type