Extropy

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]: 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)[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).

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 scalar distributions.

Returns:

J – The extropy of the distribution.

Return type:

float