antropy
antropy copied to clipboard
sample_entropy some time is inf ?
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
I encountered the same problem.
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