antropy icon indicating copy to clipboard operation
antropy copied to clipboard

modify the entropy function be able to compute vectorizly

Open cheliu-computation opened this issue 2 years ago • 2 comments

Hi, I have used your package to process the ECG signal and it achieve good results on classify different heart disease. Thanks a lot!

However, so far, these functions are only can deal with one-dimensional signal like array(~, 1). May I take a try to modify the code and make it can process the data like sklearn.preprocessing.scale(X, axis=xx)? So it will be more efficient to deal with big array, because we do not need to run the foor loop or something else.

My email is [email protected], welcome to discuss with me!

cheliu-computation avatar Dec 27 '21 23:12 cheliu-computation

Hi @cheliu-computation,

Thanks for opening the issue. Actually, some functions can handle multi-dimensional array and already have the axis argument, e.g. hjorth_params, num_zerocross, katz_fd.

Adding support for multidimensional array for the other functions will be more tricky, especially because several of these functions are based on Numba and the current implementation only supports 1D array. I think it will be a lot of work, but please feel free to give it a try.

A "cheating" approach for this could be to internally implement a call to numpy.apply_along_axis. However, this will not increase computation time compared to a standard for loop.

Thanks, Raphael

raphaelvallat avatar Dec 27 '21 23:12 raphaelvallat

Thanks for reply! I will try my best and upload the code for review. I will start with the perm_entropy and several entrop calculation function.

cheliu-computation avatar Dec 29 '21 17:12 cheliu-computation