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

Conditional Transfer Entropy Exception: Start point t=0 is too early #84

Open
groceryheist opened this issue Dec 15, 2020 · 1 comment

Comments

@groceryheist
Copy link

groceryheist commented Dec 15, 2020

Greetings!
I am using Python. I followed the tutorial using jpype. The code below works when I set the histories and delays to 1.

My code:

`
cteClass = jpype.JPackage("infodynamics.measures.continuous.kraskov").ConditionalTransferEntropyCalculatorKraskov
cte = cteClass()
cte.initialise()
cte.setProperty(cte.K_PROP_NAME,'261')
cte.setProperty(cte.K_TAU_PROP_NAME,'10')
cte.setProperty(cte.L_PROP_NAME,'261')
cte.setProperty(cte.L_TAU_PROP_NAME,'10')
cte.setProperty(cte.DELAY_PROP_NAME,'1')
cte.setProperty(cte.COND_EMBED_LENGTHS_PROP_NAME,'261')
cte.setProperty(cte.COND_EMBED_DELAYS_PROP_NAME,'10')
cte.setProperty(cte.COND_DELAYS_PROP_NAME,'1')

cte.setObservations(jpype.JArray(jpype.JDouble, 1)(ts1),jpype.JArray(jpype.JDouble, 1)(ts2), jpype.JArray(jpype.JDouble, 1)(ts3))

`

The exception is:
java.lang.Exception: java.lang.Exception: Start point t=0 is too early for a 261 length embedding vector with delay 10

It also seems like something might be wrong if I try to set up the class using initialise. The method is exposed but the parameters I set don't seem to have any effect.

@pmediano
Copy link
Collaborator

Hi groceryheist,

It's a bit hard to tell without knowing a bit more about your data or seeing an error trace, but a couple of things come to mind:

  • In general, calculator properties are not guaranteed to take effect until the next initialise() call. In your example, you are setting many properties after calling initialise(), so something may be going wrong in there. I suggest you re-order your code so initialise() is called after all the properties are set.

  • Your embedding lengths for source, target and conditionals seem very long (261!). First of all, if your time series aren't long enough then this may be the source of your error -- although even if it isn't it will make your estimation essentially unreliable unless you have a truly huge amount of data. Did you have any prior reason to expect such long embeddings to be useful in your data?

  • Why do you think that "something might be wrong if [you] try to set up the class using initialise"? That interface is (IMO) more convenient than setting all the properties one by one and should work as expected. To test it you could set up some synthetic auto-regressive time series with varying delays etc and check that it works (and if it doesn't let us know!).

If none of these fix your problem, please provide a full error trace and a complete minimally working example that doesn't depend on your data.

Cheers,
P

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

2 participants