llbxg / hundun

🦋 hundun is a python library for the exploration of chaos.
https://pypi.org/project/hundun/
MIT License
13 stars 1 forks source link

What are some reasons for getting nan corr dimension? #12

Closed qubit0 closed 11 months ago

qubit0 commented 1 year ago

I have a dataset and I want to calculate the correlation dimension for a given embedding dimension. For embedding dimensions 1 and 2, I get nan with calc_dimension_correlation. Moreover, calc_correlation_dimention_w_gp and calc_dimension_correlation give different correlation dimension for embedding dimensions 3 and 4.

Also, calc_correlation_dimention_w_gp gives me None for embedding dimensions 1 and 2.

llbxg commented 1 year ago

Sorry for the delay in answering. I do not know what kind of data you are using, so my answer is a bit abstract.

This function calculates the correlation coefficient based on the slope (gradient) being 0.999 or higher, as shown in the graph.

For example, if the number of data is small or there is a large scatter in the data, the correlation coefficient will not be greater than 0.999, so nan may be output.

A simple solution is to increase the number of data or decrease the expected value of the correlation coefficient.

D2 can be calculated by specifying min_correlation=0.99 as in the following example. (but the dimensional accuracy will be bad)

from hundun.exploration import calc_dimension_correlation
from hundun.equations import Lorenz

u_seq = Lorenz.get_u_seq(100)
D_2 = calc_dimension_correlation(u_seq, min_correlation=0.99)
print(D_2)

I can only hope that a value other than nan will be output.

llbxg commented 11 months ago

It has been quite some time since I provided an answer. If you still have questions, please either reopen this thread or create a new issue :wave: