Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEnt of discrete variable timeseries. Added example. #47

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

evanfeinberg
Copy link

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.

@evanfeinberg
Copy link
Author

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.

@cxhernandez
Copy link
Member

Not sure why it failed, the same exact test (test_adaptive()) works fine on vsp-compute.

It's been finicky, don't worry.

@cxhernandez
Copy link
Member

cxhernandez commented Sep 7, 2016

Could you make the example a python notebook when you get a chance?

I'm adding docs in #46

Update: I've made an example for mutual information. So no need to worry about it.

@cxhernandez
Copy link
Member

Also, just a reminder to add the other bugfix you had (no rush!)

@cxhernandez
Copy link
Member

Just a heads up that #46 has been merged, so we'll have to rebase this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants