Extropy¶
The extropy [LSAgro11] is a dual to the Entropy. It is defined by:
\[\X{X} = \sum_{x \in X} (1p(x)) \log_2 (1p(x))\]
The entropy and the extropy satisify the following relationship:
\[\H{X} + \X{X} = \sum_{x \in \mathcal{X}} \H{p(x), 1p(x)} = \sum_{x \in \mathcal{X}} \X{p(x), 1p(x)}\]
Unfortunately, the extropy does not yet have any intuitive interpretation.
In [1]: from dit.other import extropy
In [2]: from dit.example_dists import Xor
In [3]: extropy(Xor())
Out[3]: 1.2451124978365313
In [4]: extropy(Xor(), [0])
Out[4]: 1.0
API¶

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’ (base2).
Parameters:  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.
Returns: J – The extropy of the distribution.
Return type: