<commit_before>.. extropy.rst
.. py:module:: dit.other.extropy

*******
Extropy
*******

The extropy :cite:`Lad2011` is a dual to the entropy. It is defined by:

.. math::

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

.. math::

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

.. todo::

   discuss extropy.

.. todo::

   Compute some examples from the paper.


API
===

.. autofunction:: extropy<commit_msg>update extropy docs<commit_after>.. extropy.rst
.. py:module:: dit.other.extropy

*******
Extropy
*******

The extropy :cite:`Lad2011` is a dual to the :doc:`../multivariate/entropy`. It
is defined by:

.. math::

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

The entropy and the extropy satisify the following relationship:

.. math::

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

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

.. ipython::

   In [1]: from dit.other import extropy

   In [2]: from dit.example_dists import Xor

   @doctest float
   In [3]: extropy(Xor())
   Out[3]: 1.2451124978365313

   @doctest float
   In [4]: extropy(Xor(), [0])
   Out[4]: 1.0


API
===

.. autofunction:: extropy
{'fraction_non_alphanumeric': 0.21735731039874903, 'fraction_numerical': 0.03440187646598905, 'mean_word_length': 2.9751552795031055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1055175', 'n_tokens_mistral': 569, 'n_tokens_neox': 529, 'n_words': 142}