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

sample_entropy some time is inf ? #35

Open
allran opened this issue Aug 23, 2024 · 2 comments
Open

sample_entropy some time is inf ? #35

allran opened this issue Aug 23, 2024 · 2 comments

Comments

@allran
Copy link

allran commented Aug 23, 2024

This demo, will get inf value

 sss = np.array([5.9, 6.03, 5.97, 5.92, 5.93, 5.87, 5.89, 5.95, 6.06, 6.1, 6.06, 5.81, 5.78, 5.98, 5.89, 5.95, 6.02])
 calc_value = ant.sample_entropy(sss)
 print(calc_value) 

I read the source code, it because numerator == 0

@hasibagen
Copy link

I encountered the same problem.

@raphaelvallat
Copy link
Owner

Thanks for opening the issue. I think it's because your timeseries does not have enough samples to reliably calculate the sample entropy. That said, I would recommend trying with the implementation of sample entropy in the neurokit2 package: https://github.com/neuropsychology/NeuroKit/blob/c1104386655724a5c624e740abf651c939fc5e48/neurokit2/complexity/entropy_sample.py#L6

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