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

Continuous values for Transfer Entropy #36

Open
EricJoung1997 opened this issue Apr 13, 2022 · 3 comments
Open

Continuous values for Transfer Entropy #36

EricJoung1997 opened this issue Apr 13, 2022 · 3 comments

Comments

@EricJoung1997
Copy link

Thanks for the cool library!

I find there are binary values for Transfer Entropy input. such as :
xs = [0,1,1,1,1,0,0,0,0] ys = [0,0,1,1,1,1,0,0,0]

Is it possible to use continuous values instead of binary values, such as :
xs = [0.5,1.7,2.5,0.1,1.5,0.9,0.56,0.71,2.10] ys = [0.3,1.0,3.1,1.1,0.1,1.8,0.5,1.2,3.5]

@QunShanHe
Copy link

Thanks for the cool library!

I find there are binary values for Transfer Entropy input. such as : xs = [0,1,1,1,1,0,0,0,0] ys = [0,0,1,1,1,1,0,0,0]

Is it possible to use continuous values instead of binary values, such as : xs = [0.5,1.7,2.5,0.1,1.5,0.9,0.56,0.71,2.10] ys = [0.3,1.0,3.1,1.1,0.1,1.8,0.5,1.2,3.5]

I also have the same question, how did you solve it in the end?

@jakehanson
Copy link
Contributor

jakehanson commented Aug 26, 2024

Hi there,

Transfer entropy requires a finite number of states to be calculated. This means continuous values must be binned into discrete states before calculating transfer entropy.

The method of binning is somewhat of an art and requires specific knowledge of the problem at hand. For your values, which appear to range continuously between 0 and about 3.5, I might suggest using four integer bins. However, the more bins you use, the more sparsely populated the probability distribution becomes, so you might also consider just two bins.

For example:

xs = [0.5, 1.7, 2.5, 0.1, 1.5, 0.9, 0.56, 0.71, 2.10]
xs_binned = utils.bin_series(xs, b=2)

Then, do the same for ys and proceed with the TE calculation.

All of this is discussed thoroughly in the documentation:

https://elife-asu.github.io/PyInform/utils.html

It's best practice to try various binning techniques and see how sensitive your results are to these choices. If your results vary significantly, that's not a good sign. This problem of state-binning or "coarse-graining" continuous values is ubiquitous throughout information theory, and is a pitfall of many information-theoretic analyses.

Good luck!

Jake

@QunShanHe
Copy link

Hello Jake,

Thank you very much for your detailed response to my question.

I have tried to normalize my time series using MinMaxScaler and then multiplied it by a coefficient state_N to discretize the original data. In this scenario, do the discretized values still retain their characteristic of magnitude variation, or do the states become equal and unordered after discretization?

Additionally, how can I determine the optimal value for state_N? Would it be reasonable to assume that the state_N where the transfer entropy is maximized is the most suitable?

Qunshan

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

No branches or pull requests

3 participants