mdentropy
mdentropy copied to clipboard
TEnt of discrete variable timeseries. Added example.
In this PR, we add the ability to directly compute transfer entropy with timeseries containing discrete random variables or, equivalently, continuous data that has been pre-binned. This has been accomplished by adding a n_bins=None
to entropy()
. If n_bins=None
, entropy()
will compute counts
with numpy.bincount()
, which will directly count the frequency of each discrete label for each variable. This functionality is added at a higher level to ncmutinf()
, which gives the option of passing int
timeseries and n_bins=None
, which will then compute Transfer Entropy in the way described above.
In addition, an example has been added in an examples
folder demonstrating a usage of the above and generally how to flexibly use the MDEntropy
API.
Not sure why it failed, the same exact test (test_adaptive()) works fine on vsp-compute.
In [17]: entropy(None, RNG, 'grassberger', a, b) Out[17]: 3.6577128186414978
In [13]: TRUE_ENTROPY
Out[13]: 3.2928770664093454
that's within the tolerance.
Not sure why it failed, the same exact test (test_adaptive()) works fine on vsp-compute.
It's been finicky, don't worry.
~~Could you make the example a python notebook when you get a chance?~~
I'm adding docs in https://github.com/msmbuilder/mdentropy/pull/46
Update: I've made an example for mutual information. So no need to worry about it.
Also, just a reminder to add the other bugfix you had (no rush!)
Just a heads up that #46 has been merged, so we'll have to rebase this.