Talk:Sample entropy
This is the talk page for discussing improvements to the Sample entropy article. This is not a forum for general discussion of the article's subject. |
Article policies
|
Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||
|
Python implementation
[edit]I am trying to compare the formula given in the text and the python implementation. However, I see no reason why in the definition of B, one of the two arrays should only go to (N - m) whereas the other goes to (N - m + 1). In my opinion, both should be the same (as the -1 already removes the self-match). Am I missing something?
Nilpferd1991 (talk) 21:18, 9 May 2020 (UTC)
I agree with you. I think that both of them should be (N-m). In this way we are calculating B as dist(x(i),x(j)) with i = 1 to N-m and j =1 to N-m+1 while ref [2] states that it shoul be N-m in both cases.
--16:15, 2 March 2021 (UTC)Euldlmdcnnqa (talk)
There is more than one problem in the python implementation:
- The formula says to count all templates who's distance is _smaller_ than r. The implementation counts smaller or equal to r. This behaves differently for edge cases like
- The implementation skips the last window (template) in xmi. It should read range(L-m+1) Example: a sequence with L=3 and m=2 has two windows (starting at x[0] and x[1]), but the current implementation only considers x[0] (because range(3-2)=range(1)=[0])
- While computing A, we can not reuse xmi since it contains windows of length m instead of windows of length m+1. Instead, we have to compute new windows.
- Since we only count windows with d < r, we need to explicitly handle the case where B is 0 (e.g. for r=0) to avoid division by 0.
--14:08, 15 January 2023 (UTC) Sebastian Wallkötter — Preceding unsigned comment added by 178.132.75.20 (talk)