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

lyap_r checking number of points #60

Open
alangiontra opened this issue Jan 15, 2025 · 0 comments
Open

lyap_r checking number of points #60

alangiontra opened this issue Jan 15, 2025 · 0 comments

Comments

@alangiontra
Copy link

Where does the check for "enough data points to continue" come from? What I've noticed:

Instead of using a KNN search (as the Rosenstein algorithm does) the lyap_r function replaces distances with Inf, which, although, makes sense when looking for the minimum value that is at least min_tsep away in index. However, this code seems to ignore the case where min_tsep is the same size as ntraj. If the minimum separation is too large, MATLAB's_ lyapunovExponent, defaults the minimum separation to ntraj. When this happens, there are no nearest neighbors, so to find a neighbor, the algorithm takes the furthest neighbor. This case is not reflected in this code.

I have found that as long as min_tsep <= ((len(data) - (embed_dim - 1) * lag) - expan_rng + 1) - 2) /2, then the algorithm will run. In fact, nolds and MATLAB match for these cases, but not when min_tsep is greater.

The default for nolds is 25% of the length of the data, which ensure the above condition, but MATLAB's KNN overwrites the minimum separation to (len(data) - (embed_dim - 1) * lag) - expan_rng + 1), which is the max index.

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

1 participant