From c6fcaa76993d429668fc20462db04ace23648b2f Mon Sep 17 00:00:00 2001 From: Ryan James Date: Mon, 25 Sep 2017 16:39:55 -0700 Subject: [PATCH] fix a few bits of pid stuff --- dit/pid/iccs.py | 15 ++++++++++----- docs/measures/pid.rst | 8 ++++---- docs/references.bib | 23 +++++++++++++++++++++++ 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/dit/pid/iccs.py b/dit/pid/iccs.py index 10dc6d898e..0a62ae4a4d 100644 --- a/dit/pid/iccs.py +++ b/dit/pid/iccs.py @@ -67,21 +67,26 @@ def pmi(input_, output): pmis = {tuple(marg): pmi(marg[0], marg[1]) for marg in marginals[1:]} + inputs_dist = sub_dists[tuple(vars[:-1])] + output_dist = sub_dists[(vars[-1],)] + joint_pmis = {e: np.log2(d[e]/(inputs_dist[e[:-1]]*output_dist[(e[-1],)])) for e in d.outcomes} + + coinfos = {e: np.log2(np.prod( + [sub_dists[sub_var][tuple(e[i] for i in flatten(sub_var))] ** ((-1) ** len(sub_var)) for sub_var in sub_vars])) + for e in d.outcomes} + # fix the sign of things close to zero for pmi in pmis.values(): for e, val in pmi.items(): if np.isclose(val, 0.0): pmi[e] = 0.0 - - coinfos = {e: np.log2(np.prod( - [sub_dists[sub_var][tuple(e[i] for i in flatten(sub_var))] ** ((-1) ** len(sub_var)) for sub_var in sub_vars])) - for e in d.outcomes} for e, val in coinfos.items(): if np.isclose(val, 0.0): coinfos[e] = 0.0 i = sum(d[e] * coinfos[e] for e in d.outcomes if - all(np.sign(coinfos[e]) == np.sign(pmi[tuple(e[i] for i in marg)]) for marg, pmi in pmis.items())) + all(np.sign(coinfos[e]) == np.sign(pmi[tuple(e[i] for i in marg)]) for marg, pmi in pmis.items()) \ + and np.sign(coinfos[e]) == np.sign(joint_pmis[e])) return i diff --git a/docs/measures/pid.rst b/docs/measures/pid.rst index 120281f19a..5cc9f6315c 100644 --- a/docs/measures/pid.rst +++ b/docs/measures/pid.rst @@ -371,10 +371,10 @@ This decomposition also displays an interesting phenomena, that of *subadditive ╚════════╧════════╧════════╝ .. py:module:: dit.pid.idep -:math:`\I_{dep}` ----------------- +:math:`\Idep{\bullet}` +---------------------- -James et al have developed a method of quantifying unique information based on the :ref:`Dependency Decomposition`. Unique information from variable :math:`X_i` is evaluated as the least change in sources-target mutual information when adding the constraint :math:`X_i Y`. +James et al :cite:`james2017unique` have developed a method of quantifying unique information based on the :ref:`Dependency Decomposition`. Unique information from variable :math:`X_i` is evaluated as the least change in sources-target mutual information when adding the constraint :math:`X_i Y`. .. ipython:: @@ -393,7 +393,7 @@ James et al have developed a method of quantifying unique information based on t :math:`\Ipm{\bullet}` --------------------- -Also taking a pointwise view, Finn & Lizier's :math:`\Ipm{\bullet}` instead splits the pointwise mutual information into two components: +Also taking a pointwise view, Finn & Lizier's :math:`\Ipm{\bullet}` :cite:`finn2017` instead splits the pointwise mutual information into two components: .. math:: diff --git a/docs/references.bib b/docs/references.bib index dc4006c57f..2ed48dbb7d 100644 --- a/docs/references.bib +++ b/docs/references.bib @@ -379,6 +379,13 @@ @incollection{griffith2014quantifying publisher={Springer} } +@article{banerjee2017computing, + title={Computing the Unique Information}, + author={Banerjee, Pradeep Kr. and Rauh, Johannes and Mont{\'u}far, Guido}, + journal={arXive preprint arXiv:1709.07487}, + year={2017} +} + % i_wedge @article{griffith2014intersection, title={Intersection information based on common randomness}, @@ -403,6 +410,22 @@ @article{ince2017measuring publisher={Multidisciplinary Digital Publishing Institute} } +% i_dep +@article{james2017unique, + title={Unique Information via Dependency Constraints}, + author={James, Ryan G. and Emenheiser, Jeffrey and Crutchfield, James P.}, + journal={arXiv preprint arXiv:1709.06653}, + year={2017} +} + +% i_pm +@article{finn2017, + title={}, + author={Finn, Conor and Lizier, Joseph}, + journal={}, + year={2017} +} + %% supporting @inproceedings{bertschinger2013shared,