Next Article in Journal
Hybrid-Flash Butterfly Optimization Algorithm with Logistic Mapping for Solving the Engineering Constrained Optimization Problems
Previous Article in Journal
Entropy Analysis of the Thermal Convection of Nanosuspension within a Chamber with a Heat-Conducting Solid Fin
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Super Fast Algorithm for Estimating Sample Entropy

1
Guangdong Province Key Laboratory of Computational Science, School of Computer Science and Engineering, Sun Yat-sen University, Guangzhou 510006, China
2
Department of Mathematics and Statistics, Old Dominion University, Norfolk, VA 23529, USA
*
Author to whom correspondence should be addressed.
Entropy 2022, 24(4), 524; https://doi.org/10.3390/e24040524
Submission received: 27 February 2022 / Revised: 30 March 2022 / Accepted: 2 April 2022 / Published: 8 April 2022

Abstract

:
Sample entropy, an approximation of the Kolmogorov entropy, was proposed to characterize complexity of a time series, which is essentially defined as log ( B / A ) , where B denotes the number of matched template pairs with length m and A denotes the number of matched template pairs with m + 1 , for a predetermined positive integer m. It has been widely used to analyze physiological signals. As computing sample entropy is time consuming, the box-assisted, bucket-assisted, x-sort, assisted sliding box, and kd-tree-based algorithms were proposed to accelerate its computation. These algorithms require O ( N 2 ) or O ( N 2 1 m + 1 ) computational complexity, where N is the length of the time series analyzed. When N is big, the computational costs of these algorithms are large. We propose a super fast algorithm to estimate sample entropy based on Monte Carlo, with computational costs independent of N (the length of the time series) and the estimation converging to the exact sample entropy as the number of repeating experiments becomes large. The convergence rate of the algorithm is also established. Numerical experiments are performed for electrocardiogram time series, electroencephalogram time series, cardiac inter-beat time series, mechanical vibration signals (MVS), meteorological data (MD), and 1 / f noise. Numerical results show that the proposed algorithm can gain 100–1000 times speedup compared to the kd-tree and assisted sliding box algorithms while providing satisfactory approximate accuracy.

1. Introduction

Kolmogorov entropy is a well-suited measure for the complexity of dynamical systems containing noises. Approximate entropy (AppEn), proposed by Pincus [1], is an approximation of the Kolmogorov entropy. To overcome the biasedness of AppEn caused by self-matching, Richman proposed sample entropy (SampEn) [2] in 2000. SampEn is essentially defined as log ( B / A ) , where B denotes the number of matched template pairs with length m and A denotes the number of matched template pairs with m + 1 . SampEn has prevailed in many areas, such as cyber-physical systems, mechanical systems, health monitoring, disease diagnosis, and control. Based on AppEn and SampEn, multiscale entropy [3] and hierarchical entropy [4] were developed for measuring the complexity of physiological time series in multiple time scales. Since low-frequency filters are involved, multiscale entropy can weaken the influence of meaningless structures such as noise on complexity measurement. By adding the sample entropy of the high-frequency component of the time series, the hierarchical entropy provides more comprehensive and accurate information and improves the ability to distinguish different time series. Multiscale entropy, hierarchical entropy, and their variants have been applied to various fields such as fault identification [5,6] and feature extraction [7], beyond physiological time series analysis.
Computing SampEn requires counting the number of similar templates of time series. In other words, it requires counting the number of matched template pairs for a given time series. Clearly, direct computing of SampEn requires computational complexity of O ( N 2 ) , where N is the length of the time series analyzed. To accelerate the computation of SampEn, kd-tree based algorithms for sample entropy were proposed, which reduce the time complexity to O ( N 2 1 m + 1 ) , where m is the template (also called pattern) length [8,9]. In addition, box-assisted [10,11], bucket-assisted [12], lightweight [13], and assisted sliding box (SBOX) [14] algorithms were developed. However, the complexity of all these algorithms is O ( N 2 ) . Recently, an algorithm proposed in [15] for computing approximate values of AppEn and SampEn, without theoretical error analysis, still requires O ( N 2 ) computational costs in the worst scenario, even though it requires only O ( N ) number of operations in certain best cases. Developing fast algorithms for estimating SampEn is still of great interest.
The goal of this study is to develop a Monte-Carlo-based algorithm for calculating SampEn. The most costly step in computing SampEn is to compute the matched template ratio B / A of length m over length m + 1 . Noting that A N ( N 1 ) (resp. B N ( N 1 ) ) is the probability that templates of length m (resp. m + 1 ) are matched, the ratio B / A can be regarded as a conditional probability. From this viewpoint, we can approximate this conditional probability of the original data set by that of a data set randomly down-sampled from the original one. Specifically, we randomly select N 0 templates of lengths m and N 0 templates of m + 1 from the original time series. We then count the number A ˜ (resp. B ˜ ) of matched pairs among the selected templates of lengths m (resp. m + 1 ). We repeat this process N 1 times, and compute the mean A ¯ N 1 (resp. B ¯ N 1 ) of A ˜ (resp. B ˜ ). Then, we use log ( B ¯ N 1 / A ¯ N 1 ) to approximate log ( B / A ) for the time series to measure its complexity. We establish the computational complexity and convergence rate of the proposed algorithm. We then study the performance of the proposed algorithm, by comparing it with the kd-tree-based algorithm and the SBOX method on the electrocardiogram (ECG) time series, electroencephalogram time series (EEG), cardiac inter-beat (RR) time series, mechanical vibration signals (MVS), meteorological data (MD), and 1 / f noise. Numerical results show that the proposed algorithm can gain more than 100 times speedup compared to the SBOX algorithm (the most recent algorithm in the literature to the best of our knowledge) for a time series of length 2 16 2 18 , and more than 1000 times speedup for a time series of length 2 19 2 20 . Compared to the kd-tree algorithm, the proposed algorithm can again achieve up to 1000 times speedup for a time series of length 2 20 .
This article is organized in five sections. The proposed Monte-Carlo-based algorithm for estimating sample entropy is described in Section 2. Section 3 includes the main results of the analysis of approximate accuracy of the proposed algorithm, and the proofs are given in the Appendix A. Numerical results are presented in Section 4, and conclusion remarks are made in Section 5.

2. Sample Entropy via Monte Carlo Sampling

In this section, we describe a Monte-Carlo-based algorithm for estimating the sample entropy of a time series.
We first recall the definition of sample entropy. For all k N , let Z k : = { 1 , 2 , , k } . The distance of two real vectors a : = [ a l : l Z k ] and b : = [ b l : l Z k ] of length k is defined by
ρ ( a , b ) : = max { | a l b l | : l Z k } .
We let u : = ( u i R : i Z n ) be a time series of length n N . For m N , we let N : = n m 1 . We define a set X of N vectors by X : = x i : i Z N , where x i : = u i + l 1 : l Z m is called a template of length m for the time series u . We also define a set Y of N vectors by Y : = y i : i Z N , where y i : = u i + l 1 : l Z m + 1 is called a template of length m + 1 for u . To avoid confusion, we call the elements in X and Y the templates for the time series u . We denote by # E the cardinality of a set E. We use A i , i Z N , to denote the cardinality of the set consisting of templates x X   \ { x i } satisfying ρ ( x i , x ) r , that is,
A i : = # x X   \ { x i } : ρ ( x i , x ) r .
Likewise, for i Z N , we let
B i : = # y Y   \ { y i } : ρ ( y i , y ) r .
Letting
B : = 1 2 i Z N B i and A : = 1 2 i Z N A i ,
we define the sample entropy of time series u by
SampEn ( u , m , r ) : = log B A , if A > 0 , B > 0 , log 2 N ( N 1 ) , otherwise .
The definition of sample entropy yields the direct algorithm, which explicitly utilizes two nested loops, where the inner one computes A i and B i , and the outer one computes A and B. Algorithm 1 will be called repeatedly in the Monte-Carlo-based algorithm to be described later.
Algorithm 1 Direct method for range counting
Require:  Sequence u : = ( u i : i Z N + m ) , subset s Z N , template length m and threshold r.
1: procedure  DirectRangeCounting ( u , s , m , r )
2:     Set c o u n t = 0 ,
3:     Set L = # s ,
4:     for  i = 1 to L do
5:         Set a = [ u s i + l 1 : l Z m ] ,
6:         for  j = i + 1 to L do
7:            Set b = [ u s j + l 1 : l Z m ] ,
8:            if  ρ ( a b ) r  then
9:                 c o u n t = c o u n t + 1 ,
10:     return  c o u n t
The definition of sample entropy shows that sample entropy measures the predictability of data. Precisely, in the definition of sample entropy, B / A measures a conditional probability that when the distance of two templates a and b is less than or equal to r, the distance of their corresponding ( m + 1 ) -th component is also less than or equal to r. From this perspective, we can approximate this conditional probability of the original data set by computing it on a data set randomly down-sampled from the original one. To describe this method precisely, we define the notations as follows.
We choose a positive integer N 0 , randomly draw N 0 numbers from Z N without replacement, and form an N 0 -dimensional vector. All of such vectors form a subset Ω of the product space
Z N N 0 : = Z N Z N Z N ( N 0 -folds ) ,
that is,
Ω : = { s : = [ s 1 , , s N 0 ] Z N N 0 : s i s j for all i j } .
Suppose that F is the power set of Ω (the set of all subsets of Ω , including the empty set and Ω itself). We let P be the uniform probability measure satisfying P ( s ) = 1 / ( # Ω ) for all s Ω and define the probability space { Ω , F , P } . The definition of Ω implies # Ω = N ! ( N N 0 ) ! , and thus the probability measure satisfies P ( s ) = ( N N 0 ) ! N ! for all s Ω . The definition of F means all events that may occur in the sample space Ω are considered in the probability space { Ω , F , P } . We randomly select N 0 templates of length m and N 0 templates of length m + 1 from the original time series. We then count the number A ˜ (resp. B ˜ ) of matched pairs among the selected templates of lengths m (resp. m + 1 ). That is,
A ˜ ( s ) : = 1 2 # ( i , j ) : i , j Z N 0 with i j , and ρ ( x s i , x s j ) r , s Ω ,
and
B ˜ ( s ) : = 1 2 # ( i , j ) : i , j Z N 0 with i j , and ρ ( y s i , y s j ) r , s Ω .
We repeat this process N 1 times.
Note that A ˜ and B ˜ are random variables on the probability space { Ω , F , P } . Let A ¯ N 1 and B ¯ N 1 be the averages of random variables A ˜ and B ˜ , respectively, over the N 1 repeated processes. That is,
A ¯ N 1 : = 1 N 1 k = 1 N 1 A ˜ ( s k ) , and B ¯ N 1 : = 1 N 1 k = 1 N 1 B ˜ ( s k ) ,
where { s k : k Z N 1 } is a subset of Ω . With A ¯ N 1 and B ¯ N 1 , we can estimate the sample entropy log ( B / A ) by computing log ( B ¯ N 1 / A ¯ N 1 ) . We summarize the procedure for computing log ( B ¯ N 1 / A ¯ N 1 ) in Algorithm 2 and call it the Monte-Carlo-based algorithm for evaluating sample entropy (MCSampEn). In MCSampEn, s k , k Z N 0 , are selected by the Hidden Shuffle algorithm proposed in [16].
Algorithm 2 Monte-Carlo-based algorithm for evaluating sample entropy
Require: Sequence u = ( u i : i Z N + m ) , template length m, tolerance r R , sample size N 0 and number of experiments N 1 , probability space { Ω , F , P }
1: procedure MCSampEn ( u , m , r , N 0 , N 1 )
2:     Set A ¯ N 1 = 0 and B ¯ N 1 = 0 ,
3:     for  k = 1 to N 1  do
4:         Select s k Ω , randomly, with uniform distribution,
5:         Compute A ˜ ( s k ) by calling DirectRangeCounting ( u , s ( k ) , m , r ),
6:         Compute B ˜ ( s k ) by calling DirectRangeCounting ( u , s ( k ) , m + 1 , r ),
7:          A ¯ N 1 = A ¯ N 1 + 1 N 1 A ˜ ( s ( k ) ) ,
8:          B ¯ N 1 = B ¯ N 1 + 1 N 1 B ˜ ( s ( k ) ) ,
9:       e n t r o p y = log B ¯ N 1 A ¯ N 1 ,
10:     return  e n t r o p y
We next estimate the computational complexity of MCSampEn measured by the number of arithmetic operations. To this end, we recall Theorem 3.5 of [16] which gives the number of arithmetic operations used in the Hidden Shuffle algorithm.
Theorem 1.
The Hidden Shuffle algorithm generates a random sample of size N 0 sequentially from a population of size N with O ( N 0 ) arithmetic operations in total.
Theorem 2.
The total number of arithmetic operations needed in Algorithm 2 is O ( N 1 ( N 0 2 + N 0 ) ) .
Proof. 
For each k Z N 1 , according to Theorem 1, the number of arithmetic operations needed for selecting s ( k ) on line 4 of Algorithm 2 is O ( N 0 ) . Moreover, from Algorithm 1 we can see that for each k Z N 1 , the number of arithmetic operations needed for computing A ˜ ( s k ) and B ˜ ( s k ) on lines 5 and 6 is O ( N 0 2 ) . Thus, by counting the number of arithmetic operations needed for lines 7, 8, and 9 of Algorithm 2, we obtain the desired result. □
Theorem 2 indicates that the computational complexity of MCSampEn is controlled by setting appropriate sampling parameters N 0 and N 1 . When N 0 and N 1 are fixed, the computational complexity of MCSampEn is independent of the length N of time series u . Meanwhile, we can also select N 0 and N 1 depending on N to balance the error and computational complexity of MCSampEn. For example, we can set N 0 : = max { 1024 , N } and N 1 : = min 5 + log 2 N , N / N 0 , where a denotes the greatest integer no bigger than a R . In this case, the computational complexity is O ( N log 2 N ) .
Noting that MCSampEn provides an approximation of the sample entropy, and not the exact value, convergence of MCSampEn is an important issue. We will discuss this in Section 3.

3. Error Analysis

In this section, we analyze the error of MCSampEn. Specifically, we will establish an approximation rate of MCSampEn in the sense of almost sure convergence.
A sequence of { V k : k N } of random variables in probability space { Ω , F , P } is said to converge almost surely to V { Ω , F , P } , denoted by
V k a . s . V ,
if there exists a set N F with P ( N ) = 0 such that for all ω Ω \ N ,
lim k V k ( ω ) = V ( ω ) .
It is known (see [17]) that { V k : k N } converges almost surely to V { Ω , F , P } if and only if
lim k + P sup i k V i V > ϵ = 0 , for   all ϵ > 0 .
Furthermore, we can describe the convergence rate of { V i : i N } by the declining rate of the sequence P sup i k V i V > ϵ : k N for all ϵ > 0 . If for α > 0 ,
P sup i k V i V > ϵ = O ( k α ) , for   all ϵ > 0 ,
we say { V i : i N } converges to V almost surely with rate α .
To establish the approximation error of MCSampEn, we first derive two theoretical results for the expectations and variations of A ˜ N 0 ( N 0 1 ) and B ˜ N 0 ( N 0 1 ) . Then, by combining these results with the results of the almost sure convergence rate in [18] and the local smoothness of logarithm functions, we obtain the approximation rate of { log ( B ¯ N 1 / A ¯ N 1 ) : N 1 N } in the sense of almost sure convergence, which is the main theoretical result of this paper. We state these results below and postpone their proofs to the Appendix A.
The expectations of A ˜ N 0 ( N 0 1 ) and B ˜ N 0 ( N 0 1 ) are given in the following theorem.
Theorem 3.
It holds that for all N 0 Z N with N 0 > 1 ,
E A ˜ N 0 ( N 0 1 ) = A N ( N 1 ) ,
and
E B ˜ N 0 ( N 0 1 ) = B N ( N 1 ) .
The next theorem presents the variations of A ˜ N 0 ( N 0 1 ) and B ˜ N 0 ( N 0 1 ) .
Theorem 4.
It holds that for all N 0 Z N with N 0 > 1 ,
Var A ˜ N 0 ( N 0 1 ) = C N 0 N 0 ,
and
Var B ˜ N 0 ( N 0 1 ) = C N 0 N 0 ,
where
C N 0 : = B ( N 0 1 ) N ( N 1 ) + N 0 2 ( N 0 1 ) N ( N 1 ) ( N 2 ) l = 1 N B l 2 2 B + ( N 0 2 ) ( N 0 3 ) ( N 0 1 ) N ( N 1 ) ( N 2 ) ( N 3 ) B 2 l = 1 N B l 2 + B N 0 B 2 N 2 ( N 1 ) 2 .
Moreover, there is 0 < C N 0 < 1 + 1 2 ( N 0 1 ) .
Based on Theorems 3 and 4, we can obtain log B ¯ N 1 A ¯ N 1 a . s . log B A by the Kolmogorov strong law of large numbers and the continuous mapping theorem. However, in practice it is desirable to quantify the approximation rate in the sense of almost sure convergence, so that we can estimate the error between log B ¯ N 1 A ¯ N 1 and log B A . To this end, we define τ A : = E A ˜ N 0 ( N 0 1 ) A N ( N 1 ) , and τ B : = E B ˜ N 0 ( N 0 1 ) B N ( N 1 ) . Let γ A : = A 2 N ( N 1 ) e and γ B : = B 2 N ( N 1 ) e . For all β > 1 and 0 < ϵ < 1 , we also let
n ϵ , β : = max 6 ϵ 1 , exp 9 β 1 ϵ 1 β 1 / 1 β 1 .
With the notation defined above, we present below the main theoretical result of this paper, which gives the rate of { log B ¯ k A ¯ k : k N } approximating log B A in the sense of almost sure convergence.
Theorem 5.
Let β > 1 and N 0 Z N with N 0 > 3 . If A , B > 0 , then there exist constants D β and D ˜ β (depending only on β) such that for all 0 < ϵ < 1 and N 1 > n ϵ , β , such that
P sup k > N 1 log B ¯ k A ¯ k log B A > max { τ A , τ B } ϵ 72 C N 0 ϵ 2 N 0 N 1 D β + D ˜ β ( log N 1 ) β 1 1 τ A 2 γ A 2 + 1 τ B 2 γ B 2 .
The proof for Theorems 3–5 are included in the Appendix A. Note that Theorem 5 indicates that log B ¯ k A ¯ k approximates log B A in the sense of almost sure convergence of order 1.

4. Experiments

We present numerical experiments to show the accuracy and computational complexity of the proposed algorithm MCSampEn.
As sample entropy has been prevalently used in a large number of areas, we consider several series with a variety of statistical features, including the electrocardiogram (ECG) series, RR interval series, electroencephalogram (EEG) series, mechanical vibration signals (MVS), meteorological data (MD), and 1 / f noise. The ECG and EEG data can be downloaded from PhysioNet, a website offering access to recorded physiologic signals (PhysioBank) and related open-source toolkits (PhysioToolkit) [19]. The MVS data can be found in [20] and the website of the Case Western Reserve University Bearing Data Center [21]. The MD data can be downloaded from the website of the Royal Netherlands Meteorological Institute [22]. The databases used in this paper include:
  • Long-Term AF Database (ltafdb) [23]. This database includes 84 long-term ECG recordings of subjects with paroxysmal or sustained atrial fibrillation (AF). Each record contains two simultaneously recorded ECG signals digitized at 128 Hz with 12-bit resolution over a 20 mV range; record durations vary but are typically 24 to 25 h.
  • Long-Term ST Database (ltstdb) [24]. This database contains 86 lengthy ECG recordings of 80 human subjects, chosen to exhibit a variety of events of ST segment changes, including ischemic ST episodes, axis-related non-ischemic ST episodes, episodes of slow ST level drift, and episodes containing mixtures of these phenomena.
  • MIT-BIH Long-Term ECG Database (ltecg) [19]. This database contains 7 long-term ECG recordings (14 to 22 h each), with manually reviewed beat annotations.
  • BIDMC Congestive Heart Failure Database (chfdb) [25]. This database includes long-term ECG recordings from 15 subjects (11 men, aged 22 to 71, and 4 women, aged 54 to 63) with severe congestive heart failure (NYHA class 3–4).
  • MGH/MF Waveform Database (mghdb) [26]. The Massachusetts General Hospital/ Marquette Foundation (MGH/MF) Waveform Database is a comprehensive collection of electronic recordings of hemodynamic and electrocardiographic waveforms of stable and unstable patients in critical care units, operating rooms, and cardiac catheterization laboratories. Note that only the ECG records were considered in our experiments.
  • RR Interval Time Series (RR). The RR interval time series are derived from healthy subjects (RR/Health), and subjects with heart failure (RR/CHF) and atrial fibrillation (RR/AF).
  • CHB-MIT Scalp EEG Database (chbmit) [27]. This database contains (EEG) records of pediatric subjects with intractable seizures. The records are collected from 22 subjects, monitored for up to several days.
  • Gearbox Database (gearbox) [20]. The gearbox dataset was introduced in [20] and was published on https://github.com/cathysiyu/Mechanical-datasets (accessed on 27 March 2022).
  • Rolling Bearing Database (RB) [21]. This database as a standard reference for the rolling bearing fault diagnosis is provided by the Case Western Reserve University Bearing Data Center [21].
  • Meteorological Database (MD) [22]. The meteorological database used in this section records the hourly weather data in the past 70 years in the Netherlands.
As each database consists of multiple records from different subjects, we select one record randomly from each database. Specifically, we choose record “00” from ltafdb, “s20011” from ltstdb, “14046” from ltdb, “chf01” from chfdb, “mgh001” from mghdb, “chb07_01” from chbmit, “Miss_30_2” from gearbox, “XE110_DE_Time” from RB, and “380_t” from MD. Moreover, 1 / f noise signal, an artificial signal, is studied to increase diversity. The time series considered in this section are illustrated in Figure 1, where all samples are normalized to have a standard deviation of 1, since the parameter threshold r is proportional to the standard deviation of the records, and thus the whole range of the records is negligible.

4.1. Approximation Accuracy

In the experiments presented in this subsection, we examine the approximation accuracy of the MCSampEn algorithm. Specifically, we set r : = 0.15 and m : = 4 , 5 . We vary the sampling size N 0 and the number N 1 of computations to study the approximation accuracy of the proposed algorithm. In this experiment, records with lengths exceeding 10 6 are truncated to have length 10 6 ; otherwise, the entire records are used. Since in the MCSampEn algorithm, s k Ω are selected randomly, the outcome of the algorithm depends on the selected value of s k . To overcome the effect of the randomness, for every specified pair of ( N 0 , N 1 ) , we run the algorithm 50 times and calculate the mean errors (MeanErr) and the root mean squared errors (RMeanSqErr) of the 50 outcomes.
In our first experiment, we consider series “mghdb/mgh001”, select parameters N 0 { 200 i : i Z 20 + } , N 1 { 10 i : i Z 25 + } , and show in Figure 2 the mean errors and the root mean squared errors of the MCSampEn outputs as surfaces in the N 0 - N 1 coordinate system. Images (a) and (c) of Figure 2 show the values of M e a n E r r and images (b), (d), and (f) of Figure 2 show the values of R M e a n S q E r r . Figure 2 clearly demonstrates that both the mean errors and the root mean squared errors of the MCSampEn outputs converge to 0 as N 0 or N 1 increases to infinity. This is consistent with our theoretical analysis in the previous section.
In the second experiment, we consider all series illustrated in Figure 1 and show numerical results in Figure 3 and Figure 4. Images (a), (c), and (e) of Figure 3 show the values of M e a n E r r , and images (b), (d), and (f) of Figure 3 show the values of R M e a n S q E r r , with N 0 { 200 i : i Z 20 + } and fixed N 1 = 250 . Images (a), (c), and (e) of Figure 4 show the values of M e a n E r r , and images (b), (d), and (f) of Figure 4 show the values of R M e a n S q E r r , with N 0 = 4000 and N 1 { 10 i : i Z 25 + } . Figure 3 indicates that the outputs of the MCSampEn algorithm converge as N 0 increases. We can also see from Figure 3 that when N 0 1500 , N 1 = 150 , and m = 4 , both MeanErr and RMeanSqErr are less than 1 × 10 2 for all tested time series. In other words, the MCSampEn algorithm can effectively estimate sample entropy when N 0 1500 , N 1 = 150 , and m = 4 . From Figure 4, we can also observe that the outputs of the MCSampEn algorithm converge as N 1 increases. This is consistent with the theoretical results established in Section 3.
We next explain how the randomness of a time series effects the accuracy of the MCSampEn algorithm by applying the algorithm to the stochastic process M I X ( p ) , which has been widely applied to studies of sample entropy [1,2,28]. The M I X ( p ) is defined as follows. Let x j : = α 1 / 2 sin ( 12 π j / 12 ) for all j Z N where
α : = j = 1 12 sin 2 ( 2 π j / 12 ) / 12 .
Let { y j : j Z N } be a family of independent identically distributed (i.i.d) real random variables with uniform probability density on the interval [ 3 , 3 ] . Note that { x j : j Z N } and { y j : j Z N } are sequences with contrary properties: the former is a completely regular sine sequence, and the latter is completely random. Let p [ 0 , 1 ] , and { z j : j Z N } be a family of i.i.d random variables satisfying z j = 1 with probability p and z j = 0 with probability 1 p . Then, the M I X ( p ) process is defined as { m j : = ( 1 z j ) x j + z j y j : j Z N } . It’s not hard to find that the parameter p controls the ratio of sine sequence and random noise in the M I X ( p ) process and the increase in p makes the M I X ( p ) process more random. When p = 0 , the M I X ( p ) process is a deterministic sine sequence. Meanwhile, when p = 1 , the M I X ( p ) process turns out completely unpredictable uniform noise. This feature makes it an ideal series to study how randomness affects the accuracy of the MCSampEn algorithm.
Here, we apply MCSampEn to M I X ( p ) , p { 0.5 + 0.5 i : i Z 19 } and show the results of R M e a n S q E r r versus p in Figure 5. From Figure 5, we can observe that the values of R M e a n S q E r r increase linearly with a very small growth rate when p 0.5 . When p > 0.5 , the values of R M e a n S q E r r are significantly faster than that of p 0.5 . Therefore, we believe that when the randomness of a time series is weak, the error of the MCSampEn algorithm is small; as the randomness of the time series increases, the error of the MCSampEn grows.

4.2. Time Complexity

In the experiments presented in this subsection, we compare the computing time of the MCSampEn algorithm with that of the kd-tree algorithm [8] and SBOX algorithm [14], under the condition that the value of sample entropy computed by the MCSampEn algorithm is very close to the ground truth value. The computational time experiments are performed on a desktop computer running Windows 11, with an Intel(R) Core(TM) i5-9500 CPU, and 32GB RAM. The implementations of the kd-tree-based algorithm and the MCSampEn algorithm are available on the website https://github.com/phreer/fast_sampen_impl.git (accessed on 30 March 2022). As for the SBOX method, we utilize the implementation given by the original author, published on website https://sites.google.com/view/yhw-personal-homepage (accessed on 25 October 2021). To demonstrate the validity of the MCSampEn algorithm, we also show both the sample entropy estimated by MCSampEn and the corresponding ground truth.
As we have discussed above, the time complexity of the MCSampEn algorithm depends on the parameters N 0 and N 1 . In this subsection, we discuss two strategies for choosing N 0 and N 1 :
S1 
Choose N 0 and N 1 to be independent of N, for example N 0 = 2 × 10 3 and N 1 = 150 .
S2 
Choose N 0 = max { 1024 , N } and N 1 = min 5 + log 2 N , N / N 0 , depending on N.
An intuitive explanation of the second strategy is shown below. We would like to choose N 0 and N 1 such that the overall time complexity of executing the algorithm is O ( N log N ) . For this purpose, we expect N 0 to grow like N and N 1 to grow logarithmically in N. However, when N is not large enough, lack of sampling templates can seriously impair the accuracy of the algorithm. To overcome this problem, we set a lower bound of N 0 to 1024, which is a good trade-off between accuracy and time complexity. The experimental results in this subsection show that this strategy can produce satisfactory output even when N is small.
The results on different signals “ltafdb/00”, “ 1 / f noise”, “chbmit/chb07_01”, and “ltecg/14046” are shown in Figure 6, where the first strategy is adopted by setting N 0 = 2 × 10 3 and N 1 = 150 , and the results for m = 4 are marked by red color, and the results for m = 5 are marked by blue. In the left column of Figure 6, the values of computation time consumed by the kd-tree, SBOX, and MCSampEn algorithms are plotted, respectively, with the dashed lines marked “x”, the dash-dot lines marked “+”, and the solid lines marked “o”. From the results shown in the left column of Figure 6, we can find that MCSampEn is faster than the SBOX algorithm when N is greater than 2 15 . We also can see when the time series “chbmit/chb07_01” and “ltecg/14046” have length N of 2 20 , MCSampEn is nearly 1000 times faster than the SBOX algorithm. Compared to the kd-tree algorithm, the MCSampEn algorithm can still achieve up to hundreds of times acceleration when N = 2 20 . In addition, the time complexity of MCSampEn algorithm is close to a constant relative to m, and is much smaller than the kd-tree and SBOX algorithms when N is large enough. Meanwhile, the computational time (shown in the left column of Figure 6) required is hardly affected by the times series length N.
The right column of Figure 6 shows the average of 50 outputs of the MCSampEn algorithm for different time series under the settings of N 0 = 2 × 10 3 and N 1 = 150 , where the red solid lines plot the average for the cases of m = 4 , and the blue solid lines plot the average for the cases of m = 5 . In the right column of Figure 6, the values of ground truth for the cases of m = 4 and m = 5 are plotted by the red and blue dashed lines, respectively. Meanwhile, in the right column of Figure 6, we use error bars “I” to represent the values of R M e a n S q E r r , where the larger the value of R M e a n S q E r r , the longer the error bar “I”. From the length of error bar “I”, we can see that the values of R M e a n S q E r r are small compared to the ground truth. Especially on the time series “ltafdb/00”, “chbmit/chb_0701”, and “ltecg/14046”, the values of R M e a n S q E r r are negligible compared to the values of ground truth. These results imply that when N 0 = 2 × 10 3 and N 1 = 150 , the sample entropy estimated by the MCSampEn algorithm can effectively approximate the ground truth value.
The results of the second strategy are shown in Figure 7, where N 0 = max { 1024 , N } and N 1 = min 5 + log 2 N , N / N 0 . The results for m = 4 are marked by red color, and the results for m = 5 are marked by blue color. The left column of Figure 6 shows the values of computation time consumed by the kd-tree, SBOX, and MCSampEn algorithms, which are presented by the dashed lines marked “x”, the dash-dot lines marked “+”, and the solid lines marked “o”, respectively. From the left column of Figure 7, we also can see that with the second strategy, the computational time of MCSampEn algorithm is much less than that of the kd-tree and SBOX algorithms, since the computational complexity of Algorithm 2 is O ( N log N ) . Furthermore, we observe that MCSampEn achieves a speedup of more than 100 compared to the SBOX algorithm when N goes from 2 16 to 2 18 , and it is over 1000 times faster when N = 2 20 . Compared to the kd-tree algorithm, the MCSampEn algorithm can still obtain up to 1000 times acceleration when N = 2 20 .
In the right column of Figure 7, we plot the average of 50 outputs of the MCSampEn algorithm for different time series by the red and blue solid lines for m = 4 and m = 5 , respectively. At the same time, the values of ground truth for the cases of m = 4 and m = 5 are plotted by the red and blue dashed lines, respectively. As in Figure 6, we use the error bar “I” to represent the values of R M e a n S q E r r . Comparing the error bar “I” in Figure 6, we can see that the values of the R M e a n S q E r r in this experiment are larger than that shown in Figure 6. However, the value of R M e a n S q E r r is still small in terms of the values of ground truth. Moreover, we can observe that the length of the error bars decreases as N increases. This means that we can obtain a better approximation of sample entropy as the time series length increases.
To reveal the effect of randomness on the speedup, we compare the time taken by the kd-tree and MCSampEn algorithms to compute the sample entropy of the time series M I X ( p ) , p { 0.5 + 0.5 i : i Z 19 } . The experimental results are shown in Figure 8, where the results for m = 4 are marked by red color, and the results for m = 5 are marked by blue. The values of computation time consumed by the kd-tree and MCSampEn algorithms are plotted, respectively, with the dashed lines marked “x” and the solid lines marked “o”. In this experiment, we set N = 2 20 and r = 0.15 . We also let N 0 = 1000 + 3000 p and N 1 = 80 + 70 p to ensure that the relative error R M e a n S q E r r / S a m p E n is no greater than 0.02 . From Figure 8, we can see that when the value of p is less than 0.2 , compared with the kd-tree algorithm, the MCSampEn algorithm can achieve 300 to 1000 times speedup. When the value of p is greater than 0.8 , our algorithm can still obtain a 10x speedup relative to the kd-tree algorithm.
From the experiments in this subsection, we can observe that the MCSampEn algorithm can achieve a high speedup when it is applied to different types of signals. In fact, compared with kd-tree algorithm, the MCSampEn algorithm can achieve high accuracy and more than 300 times acceleration when the time series has less randomness. When the randomness of the time series is high, our algorithm can still obtain a speedup of nearly 10 times.

4.3. Memory Usage

In order to show the performance of the MCSampEn algorithm more comprehensively, we also compare the memory usage of the kd-tree and MCSampEn algorithms. The memory usage on signal “ltstdb/s20011” is shown in Figure 9, where the memory usage for m = 4 and m = 5 is shown in Figure 9a,b, respectively. In this figure, the memory usage of the kd-tree algorithm is plotted by the blue dash-dot lines marked “x”. The memory usage of the MCSampEn algorithm with the first and second strategies is plotted by the green dashed lines marked “+” and the red dotted lines marked “o”, respectively. In Figure 9, the first strategy is adopted by setting N 0 = 2048 and N 1 = 150 , and the second strategy is adopted by N 0 = max { 1024 , N } and N 1 = min 5 + log 2 N , N / N 0 . We also present the memory usage for storing the data by the black solid lines marked “□”.
From the results shown in Figure 9, it can be seen that when the size of the data is 2 20 , the memory required by the kd-tree algorithm is almost 36 times that of the memory required by the MCSampEn algorithm. This is because the kd-tree algorithm requires a large memory space to save the kd-tree. Meanwhile, the experimental results in Figure 9 also show that the amount of memory required by the MCSampEn algorithm is only about 15 MB more than the amount of memory required to store the data when the length of data is between 2 14 and 2 24 . This is because the MCSampEn algorithm requires additional memory for storing N 0 templates and to execute the subroutines that generate random numbers.
Because the MCSampEn algorithm is based on Monte Carlo sampling and the law of large numbers, it is an easily parallelizable algorithm. Therefore, combined with distributed storage techniques, the idea of the MCSampEn algorithm can be used to compute sample entropy for large-scale data (for example, where the size of data is larger than 1 TB). Parallel algorithms for computing sample entropy of large-scale data will be our future work.

5. Conclusions

In this paper, we propose a Monte-Carlo-based algorithm called MCSampEn to estimate sample entropy and prove that the outputs of MCSampEn can approximate sample entropy in the sense of almost sure convergence of order 1. We provide two strategies to select the sampling parameters N 0 and N 1 , which appear in MCSampEn. The experiment results show that we can flexibly select the parameters N 0 and N 1 to balance the computational complexity and error. From the experimental results, we can observe that the computational time consumed by the proposed algorithm is significantly shorter than the kd-tree and SBOX algorithms, with negligible loss of accuracy. Meanwhile, the computational complexity of our MCSampEn method is hardly affected by the time series length N. We also study how the randomness of the time series affects the accuracy and computation time of the MCSampEn algorithm by applying the algorithm to the stochastic process M I X ( p ) . The results indicate that the proposed algorithm performs well for time series with less randomness.

Author Contributions

Conceptualization, Y.J.; methodology, Y.J. and W.L.; software, W.L.; validation, Y.J. and W.L.; formal analysis, Y.J. and W.L.; investigation, Y.J.; writing—original draft preparation, W.L.; writing—review and editing, Y.J. and Y.X.; visualization, W.L.; supervision, Y.J.; project administration, Y.J.; funding acquisition, Y.J. All authors have read and agreed to the published version of the manuscript.

Funding

W. Liu and Y. Jiang are supported in part by the Key Area Research and Development Program of Guangdong Province, China (No. 2021B0101190003); the Natural Science Foundation of Guangdong Province, China (No.2022A1515010831); and Science and Technology Program of Guangzhou, China (No. 201804020053). Yuesheng Xu was supported in part by US National Science Foundation under grant DMS-1912958.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data used are included in the article.

Conflicts of Interest

The authors declare no conflict of interest.

Appendix A

In this Appendix, we provide proofs of Theorems 3–5, where Theorems 3 and 4 describe the expectations and variances of A ˜ N 0 ( N 0 1 ) and B ˜ N 0 ( N 0 1 ) , and Theorem 5 presents the convergence rate of { log B ¯ k A ¯ k : k N } .
Note that the only difference in the definitions between A ˜ N 0 ( N 0 1 ) and B ˜ N 0 ( N 0 1 ) is the template length. Without loss of generality, we discuss the expectation (2) and variation (4) of B ˜ N 0 ( N 0 1 ) . The Equations (1) and (3) of A ˜ N 0 ( N 0 1 ) can be obtained in a similar way.
To analyze the expectation of B ˜ N 0 ( N 0 1 ) , we define the following notation. For all j Z N 0 , we define random variable B ˜ j on the probability space { Ω , F , P } by
B ˜ j ( s ) : = # i Z N 0 : i j and ρ ( y s i , y s j ) r , s Ω .
For all j Z N 0 , the definition of B ˜ j indicates that B ˜ j ( s ) is the number of elements in { y s i : i Z N 0 } that satisfy ρ ( y s i , y s j ) r and i j . From the definitions of B ˜ and B ˜ j , we have that for all s Ω ,
B ˜ ( s ) = 1 2 j = 1 N 0 B ˜ j ( s ) .
For p , q , l N , we say random variable V follows the hypergeometric distribution H ( p , q , l ) if and only if the probability of V = k
Pr ( V = k ) = q k p q l q p l , if max { 0 , q + l p } k min { q , l } , 0 , otherwise .
See Section 5.3 of [29] for more details about the hypergeometric distribution. For all l Z N , let B l : = { i Z N : i l and ρ ( y i , y l ) r } , which is the index set of elements of Y satisfying ρ ( y i , y l ) r . From the definition of B l , we have that B l = # B l . For the purpose of analyzing the expectation of B ˜ N 0 ( N 0 1 ) , we recall the expectation of the hypergeometric distribution H ( p , q , l ) (see Theorem 5.3.2 in [29]) and prove a technical lemma as follows.
Theorem A1.
For p , q , l N , the expectation of the hypergeometric distribution H ( p , q , l ) is q l p .
Lemma A1.
Let N 0 Z N with N 0 > 1 . For any fixed j Z N 0 and l Z N , the conditional probability distribution of B ˜ j given s j = l is the hypergeometric distribution H ( N 1 , B l , N 0 1 ) . Moreover, for all j Z N 0 , the expectation of random variable B ˜ j is
E B ˜ j = 2 ( N 0 1 ) N ( N 1 ) B .
Proof. 
Let j Z N 0 and l Z N . From the definition of B ˜ j , we can see that for all s Ω with s j = l , B ˜ j ( s ) min { B l , N 0 1 } . On the other hand, since for all s Ω with s j = l ,
i Z N 0 : ρ ( y s i , y l ) > r i Z N : ρ ( y i , y l ) > r ,
from the definitions of B ˜ j and B l , we have that N 0 B ˜ j N B l . Thus, we can see that for all s Ω with s j = l , max { 0 , N 0 N + B l } B ˜ j min { N 0 1 , B l } . This means that for k < max { 0 , N 0 N + B l } or k > min { N 0 1 , B l } ,
# { s Ω : B ˜ j ( s ) = k and s j = l } = 0 .
Meanwhile, it can be checked that for all s Ω with s j = l and max { 0 , N 0 N + B l } k min { N 0 1 , B l } , B ˜ j ( s ) = k if and only if vector s contains k components belonging to B l , and N 0 1 k components belonging to Z N / ( B l { l } ) . Note that there are B l k ways of drawing k elements from set B l , and N 1 B l N 0 1 k ways of drawing N 0 1 k elements from set Z N / ( B l { l } ) . Thus, by noting that each element in Ω is a permutation formed by extracting N 0 numbers from Z N , we have that for all max { 0 , N 0 N + B l } k min { N 0 1 , B l } ,
# { s Ω : B ˜ j ( s ) = k and s j = l } = ( N 0 1 ) ! B l k N 1 B l N 0 1 k .
Note that # { s Ω : s j = l } = ( N 1 ) ! ( N N 0 ) ! , and the elements in { s Ω : s j = l } are of equal probability. Hence, dividing the right term of (A3) by ( N 1 ) ! ( N N 0 ) ! , we obtain
P B ˜ j = k s j = l = B l k N 1 B l N 0 1 B l N 1 N 0 1 , max { 0 , N 0 N + B l } k min { N 0 1 , B l } , 0 , otherwise .
This indicates that the conditional probability distribution of B ˜ j given s j = l is the hypergeometric distribution H ( N 1 , B l , N 0 1 ) (see [29]).
Since the conditional probability distribution of B ˜ j given s j = l is the hypergeometric distribution H ( N 1 , B l , N 0 1 ) , from Theorem A1 we have for any j Z N 0 and l Z N , E B ˜ j s j = l = B l ( N 0 1 ) N 1 . Thus, by noting l Z N B l = 2 B and P s j = l = 1 N for all l Z N , from the law of total expectation we obtain (A2). □
The proof for Theorem 3 is shown as follows.
Proof. 
From the definitions of B ˜ and B ˜ j , we know
E B ˜ = 1 2 j = 1 N 0 E B ˜ j .
Substituting (A2) into (A4) leads to (2). □
Next we consider the variance of B ˜ N 0 ( N 0 1 ) . Since B ˜ = 1 2 j Z N 0 B ˜ j , the variance of B ˜ N 0 ( N 0 1 ) can be obtained by summing the covariances E [ B ˜ j 1 B ˜ j 2 ] , j 1 , j 2 Z N 0 . This motivates us to compute these covariances. As a preparation, we establish two auxiliary lemmas. For all k , l Z N with k l , we define B k l : = B k B l and B k l : = # B k l .
Lemma A2.
It holds that
k Z N l Z N \ { k } B k l = l Z N B l 2 2 B .
Proof. 
Note that B k l B k l is not necessarily empty for ( k , l ) ( k , l ) . For B k l , we define new sets Π k l so that they mutually disjoint and have the same cardinality as B k l . In this way, the formula (A5) will be proved by establishing a set identity and counting their cardinality. To this end, we define Π k l : = ( p , k , l ) : p B k l , for each k , l Z N with k l , and Π p : = ( p , k , l ) : k , l B p with k l , for each p Z N . From the definition of Π k l , we have that # Π k l = B k l and Π k l Π k l = if ( k , l ) ( k , l ) . Thus,
k Z N l Z N \ { k } B k l = # k Z N l Z N \ { k } Π k l .
Likewise, the definition of Π p ensures that # Π p = B p ( B p 1 ) and Π p Π p = if p p . Thus, by noting that 2 B = p Z N B p ,
p Z N B p 2 2 B = p Z N B p ( B p 1 ) = # p Z N Π p .
Combining Equations (A6) and (A7), we see that it suffices to prove
k Z N l Z N \ { k } Π k l = p Z N Π p .
For all k , l Z N with k l , and ( p , k , l ) Π k l , the definitions of Π k l and B k l ensure
p k , p l , ρ ( y p , y k ) r and ρ ( y p , y l ) r .
In other words, there are k B p , l B p and k l . Thus, for all k , l Z N with k l , and ( p , k , l ) Π k l , there has ( p , k , l ) Π p . Thus, we obtain
k Z N l Z N \ { k } Π k l p Z N Π p .
On the other hand, for all p Z N and ( p , k , l ) Π p , we know (A9) holds and k l from the definitions of Π p and B p . This means that ( p , k , l ) Π k l and k l . Hence, we obtain that
p Z N Π p k Z N l Z N \ { k } Π k l .
From (A10) and (A11) we obtain (A8), which leads to the desired result (A5). □
For i , j Z N 0 with i j , we define random variable Z i j on the probability space { Ω , F , P } by
Z i j ( s ) : = 1 , if ρ ( y s i , y s j ) r , 0 , if ρ ( y s i , y s j ) > r , s Ω .
From the definition of B ˜ j , we can see that B ˜ j = i Z N 0 \ { j } Z i j . Thus, in order to compute the covariance E [ B ˜ j 1 B ˜ j 2 ] , we next show the values of P ( Z i 1 j 1 = 1 , Z i 2 j 2 = 1 ) for j 1 , j 2 Z N 0 and i 1 , i 2 Z N 0 \ { j 1 , j 2 } with i 1 i 2 .
Lemma A3.
It holds that for j 1 , j 2 Z N 0 with j 1 j 2 , and i 1 , i 2 Z N 0 \ { j 1 , j 2 } with i 1 i 2 ,
P ( Z i 1 j 1 = 1 , Z i 2 j 2 = 1 ) = 4 B 2 + B l Z N B l 2 N ( N 1 ) ( N 2 ) ( N 3 ) .
Moreover, for all j Z N 0 and i , i Z N 0 \ { j } with i i , it holds that
P ( Z i j = 1 , Z i j = 1 ) = l Z N B l 2 2 B N ( N 1 ) ( N 2 ) .
Proof. 
We first prove (A13). Let
L N 0 : = { ( i 1 , j 1 , i 2 , j 2 ) : j 1 , j 2 Z N 0 with j 1 j 2 , and i 1 , i 2 Z N 0 \ { j 1 , j 2 } with i 1 i 2 }
and for all ( i 1 , j 1 , i 2 , j 2 ) L N 0 , we define
Ω i 1 j 1 , i 2 j 2 : = { s Ω : Z i 1 j 1 ( s ) = 1 , and Z i 2 j 2 ( s ) = 1 } .
We prove (A13) by counting the cardinality of Ω i 1 j 1 , i 2 j 2 . To this end, we identify Ω i 1 j 1 , i 2 j 2 as the union of disjoint subsets of Ω i 1 j 1 , i 2 j 2 . From the definition of Z i 1 j 1 and Z i 2 j 2 , we know for all ( i 1 , j 1 , i 2 , j 2 ) L N 0 and s Ω i 1 j 1 , i 2 j 2 that s i 1 B s j 1 and s i 2 B s j 2 . At the same time, note that for ( i 1 , j 1 , i 2 , j 2 ) L N 0 and s Ω i 1 j 1 , i 2 j 2 , the numbers in set { s j 1 , s j 2 , s i 1 , s i 2 } are distinct. Thus, for all ( i 1 , j 1 , i 2 , j 2 ) L N 0 and s Ω i 1 j 1 , i 2 j 2 , it holds that s j 1 s j 2 , s i 1 B s j 1 \ { s j 2 } , and s i 2 B s j 2 \ { s i 1 , s j 1 } . Namely,
Ω i 1 j 1 , i 2 j 2 { s Ω : s j 1 s j 2 , s i 1 B s j 1 \ { s j 2 } , and s i 2 B s j 2 \ { s i 1 , s j 1 } } .
On the other hand, it is easy to check that
Ω i 1 j 1 , i 2 j 2 { s Ω : s j 1 s j 2 , s i 1 B s j 1 \ { s j 2 } , and s i 2 B s j 2 \ { s i 1 , s j 1 } } .
Thus, for all ( i 1 , j 1 , i 2 , j 2 ) L N 0 , Ω i 1 j 1 , i 2 j 2 can be rewritten as
Ω i 1 j 1 , i 2 j 2 = { s Ω : s j 1 s j 2 , s i 1 B s j 1 \ { s j 2 } , and s i 2 B s j 2 \ { s i 1 , s j 1 } } .
For k l , we define Ω i 1 j 1 , i 2 j 2 k , l : = { s Ω i 1 j 1 , i 2 j 2 : s j 1 = k , s j 2 = l } . Then, we can rewrite Ω i 1 j 1 , i 2 j 2 as
Ω i 1 j 1 , i 2 j 2 = k Z N l Z N \ { k } Ω i 1 j 1 , i 2 j 2 k , l .
Since Ω i 1 j 1 , i 2 j 2 k , l Ω i 1 j 1 , i 2 j 2 k , l = if ( k , l ) ( k , l ) , from (A15) we can see that
# Ω i 1 j 1 , i 2 j 2 = k Z N l Z N \ { k } # Ω i 1 j 1 , i 2 j 2 k , l .
Note that for all k Z N and l Z N \ { k } ,
Ω i 1 j 1 , i 2 j 2 k , l = { s Ω : s j 1 = k , s j 2 = l , s i 1 B k \ ( B k l { l } ) and s i 2 B l \ { k } } { s Ω : s j 1 = k , s j 2 = l , s i 1 B k l and s i 2 B l \ { s i 1 , k } } ,
and the two sets on the right-hand side of the above equation are disjoint. Thus, it holds that for all k Z N and l Z N \ { k } ,
# Ω i 1 j 1 , i 2 j 2 k , l = ( N 4 ) ! ( N N 0 ) ! ( B k B k l Z k l ) ( B l Z k l ) + B k l ( B l Z k l 1 ) .
Substituting (A17) into (A16) leads to
# Ω i 1 j 1 , i 2 j 2 = ( N 4 ) ! ( N N 0 ) ! k Z N l Z N \ { k } ( B k B k l Z k l ) ( B l Z k l ) + B k l ( B l Z k l 1 ) .
By direct computation with noting Z k l 2 = Z k l , we obtain from the equation above that
# Ω i 1 j 1 , i 2 j 2 = ( N 4 ) ! ( N N 0 ) ! k Z N l Z N \ { k } B k B l B k Z k l B l Z k l B k l + Z k l .
Note that k Z N \ { l } Z k l = B l and l Z N \ { k } B l = 2 B B k . We then have that
k Z N l Z N \ { k } B l Z k l = l Z N k Z N \ { l } B l Z k l = l Z N B l k Z N \ { l } Z k l = l Z N B l 2 ,
k Z N l Z N \ { k } B k B l = k Z N B k ( 2 B B k ) = 4 B 2 l Z N B l 2 ,
and
k Z N l Z N \ { k } Z k l = 2 B .
Substituting (A5) and the above equations into (A18), we obtain that
# Ω i 1 j 1 , i 2 j 2 = 4 ( N 4 ) ! ( N N 0 ) ! B 2 + B l Z N B l 2 .
By noting that # Ω = N ! ( N N 0 ) ! and P ( Z i 1 j 1 = 1 , Z i 2 j 2 = 1 ) = # Ω i 1 j 1 , i 2 j 2 # Ω , we obtain (A13) from (A19).
We now turn to prove (A14). Let j Z N 0 and i , i Z N 0 \ { j } with i i . Note that
# { s Ω : Z i j ( s ) = Z i j ( s ) = 1 } = l Z N # { s Ω : s j = l , s i B l and s i B l \ { s i } } = ( N 3 ) ! ( N N 0 ) ! l Z N B l ( B l 1 ) .
Thus, it holds that
P ( Z i j = 1 , Z i j = 1 ) = l Z N B l ( B l 1 ) N ( N 1 ) ( N 2 ) .
Since l Z N B l = 2 B , from (A20) we obtain (A14). □
With the help of Lemma A3, we can calculate E B ˜ j 1 B ˜ j 2 in the following lemma.
Lemma A4.
If N 0 Z N with N 0 > 3 , then for all j 1 , j 2 Z N 0 with j 1 j 2 ,
E B ˜ j 1 B ˜ j 2 = 4 ( N 0 2 ) ( N 0 3 ) N ( N 1 ) ( N 2 ) ( N 3 ) B 2 + B l Z N B l 2 + 3 ( N 0 2 ) l Z N B l 2 2 B N ( N 1 ) ( N 2 ) + 2 B N ( N 1 ) ,
and for all j Z N 0 ,
E B ˜ j 2 = 2 ( N 0 1 ) B N ( N 1 ) + ( N 0 1 ) ( N 0 2 ) N ( N 1 ) ( N 2 ) l Z N B l 2 2 B .
Proof. 
We first prove (A21). Let j 1 , j 2 Z N 0 with j 1 j 2 . From the decomposition B ˜ j = i Z N 0 \ { j } Z i j , we obtain for all j 1 , j 2 Z N 0 with j 1 j 2 that
E B ˜ j 1 B ˜ j 2 = i 1 Z N 0 \ { j 1 } i 2 Z N 0 \ { j 2 } E Z i 1 j 1 Z i 2 j 2 .
We further rewrite the right-hand side of the above equation to obtain
E B ˜ j 1 B ˜ j 2 = i 1 Z N 0 \ { j 1 , j 2 } i 2 Z N 0 \ { j 1 , j 2 , i 1 } E Z i 1 j 1 Z i 2 j 2 + i 1 Z N 0 \ { j 1 , j 2 } E Z i 1 j 1 Z i 1 j 2 + i 1 Z N 0 \ { j 1 , j 2 } E Z i 1 j 1 Z j 1 j 2 + i 2 Z N 0 \ { j 1 , j 2 } E Z j 2 j 1 Z i 2 j 2 + E Z j 2 j 1 Z j 1 j 2 .
We next compute the terms on the right hand side of (A23) one by one. Since for all j , j Z N 0 , i Z N 0 \ { j } and i Z N 0 \ { j } ,
E Z i j Z i j = P ( Z i j = 1 , Z i j = 1 ) ,
from Equation (A13) of Lemma A3, we know the first term in the right-hand side of (A23) satisfies
i 1 Z N 0 \ { j 1 , j 2 } i 2 Z N 0 \ { j 1 , j 2 , i 1 } E Z i 1 j 1 Z i 2 j 2 = 4 B 2 + B l Z N B l 2 N ( N 1 ) ( N 2 ) ( N 3 ) ( N 0 2 ) ( N 0 3 ) .
Likewise, by noting that Z i j = Z j i , from Equation (A14) of Lemma A3, we obtain the second, third, and fourth terms on the right-hand side of (A23),
i 1 Z N 0 \ { j 1 , j 2 } E Z i 1 j 1 Z i 1 j 2 = i 1 Z N 0 \ { j 1 , j 2 } E Z i 1 j 1 Z j 1 j 2 = i 2 Z N 0 \ { j 1 , j 2 } E Z j 2 j 1 Z i 2 j 2 = ( N 0 2 ) l Z N B l 2 2 B N ( N 1 ) ( N 2 ) .
Note that for all i , j Z N 0 with i j , it holds that Z i j = Z j i and Z i j 2 = Z i j . Thus, the last term on the right-hand side of (A23) satisfies
E Z j 2 j 1 Z j 1 j 2 = 2 B N ( N 1 ) .
Substituting (A24), (A25), and (A26) into (A23) leads to (A21).
It remains to prove (A22). Since for all j Z N 0 , B ˜ j = i Z N 0 \ { j } Z i j = i Z N 0 \ { j } Z i j 2 , there has
E B ˜ j 2 = E i Z N 0 \ { j } Z i j 2 + i 1 Z N 0 \ { j } i 2 Z N 0 \ { j , i 1 } Z i 1 j Z i 2 j , = E B ˜ j + i 1 Z N 0 \ { j } i 2 Z N 0 \ { j , i 1 } Z i 1 j Z i 2 j = E B ˜ j + i 1 Z N 0 \ { j } i 2 Z N 0 \ { j , i 1 } E Z i 1 j Z i 2 j .
Note that for all j Z N 0 , i 1 Z N 0 \ { j } and i 2 Z N 0 \ { j , i 1 } ,
E Z i 1 j Z i 2 j = P ( Z i 1 j = 1 , Z i 2 j = 1 ) .
Thus, substituting (A2) and (A14) into (A27), we obtain (A22). □
Now, we are ready to discuss the variance of B ˜ N 0 ( N 0 1 ) .
The proof for Theorem 4 is shown as follows.
Proof. 
To prove this theorem, we compute E [ B ˜ 2 ] . Noting that B ˜ = 1 2 j = 1 N 0 B ˜ j , we have
E B ˜ 2 = 1 4 j Z N 0 E B ˜ j 2 + j 1 Z N 0 j 2 Z N 0 \ { j 1 } E B ˜ j 1 B ˜ j 2 .
Substituting (A21) and (A22) into (A28) leads to
E B ˜ 2 = N 0 ( N 0 1 ) N ( N 1 ) B + N 0 ( N 0 1 ) ( N 0 2 ) N ( N 1 ) ( N 2 ) p = 1 N B p 2 2 B + N 0 ( N 0 1 ) ( N 0 2 ) ( N 0 3 ) N ( N 1 ) ( N 2 ) ( N 3 ) B 2 p = 1 N B p 2 + B .
Since
Var B ˜ N 0 ( N 0 1 ) = E B ˜ N 0 ( N 0 1 ) 2 E B ˜ N 0 ( N 0 1 ) 2 ,
by conducting some computation, from (A29) and the definition of C N 0 (5), we obtain (4).
We next estimate C N 0 . It can be checked that
C N 0 = ( N 0 2 ) l Z N B l 2 ( N 0 1 ) ( N 1 ) N ( N 2 ) 1 N 0 3 N 3 + B ( N 0 1 ) N ( N 1 ) 1 2 N 0 2 N 2 + ( N 0 2 ) ( N 0 3 ) ( N 2 ) ( N 3 ) + B 2 N ( N 1 ) ( N 0 1 ) ( N 0 2 ) ( N 0 3 ) ( N 2 ) ( N 3 ) N 0 ( N 0 1 ) N ( N 1 ) .
By noting l Z N B l 2 ( N 1 ) 2 N 1 , ( N 0 2 ) ( N 1 ) ( N 0 1 ) ( N 2 ) 1 and 0 1 N 0 3 N 3 1 , we know the first term in (A30) is not greater than 1. Since B N ( N 1 ) < 1 2 and 1 2 N 0 2 N 2 + ( N 0 2 ) ( N 0 3 ) ( N 2 ) ( N 3 ) 1 N 0 2 N 2 2 < 1 , we have that the second term in (A30) is not greater than 1 N 0 1 . Note that ( N 0 2 ) ( N 0 3 ) ( N 2 ) ( N 3 ) N 0 ( N 0 1 ) N ( N 1 ) 0 . Thus, we know the third term in (A30) is not positive. Therefore, we conclude that C N 0 1 + 1 2 ( N 0 1 ) . □
To analyze this almost sure convergence rate of log B ¯ k A ¯ k : k N , we require Theorem 2 of [18], which is recalled as follows.
Theorem A2.
Let { V i : i N } { V } be a sequence of independent and identically distributed random variables in probability space { Ω , F , P } with expectation μ, σ : = Var [ V i ] and τ : = E | V i μ | . If σ < + and τ < + , then for all 0 < ϵ 1 and β > 1 , there are constants D β and D ˜ β (depending only on β) such that for all i > n ϵ , β ,
P sup k i 1 k l = 1 k V l μ > τ ϵ 72 σ τ 2 ϵ 2 i D β + D ˜ β ( log i ) β 1 ,
where n ϵ , β is defined by (6).
Combining Theorems 3, 4, and A2 leads to the almost sure convergence of B ¯ N 1 N 0 ( N 0 1 ) and A ¯ N 1 N 0 ( N 0 1 ) in the next lemma.
Lemma A5.
Let β > 1 and N 0 Z N with N 0 > 3 . Then, there are constants D β and D ˜ β (depending only on β) such that for all 1 ϵ > 0 and N 1 > n ϵ , β ,
P sup k > N 1 A ¯ k N 0 ( N 0 1 ) A N ( N 1 ) > τ A ϵ 72 C N 0 τ A 2 ϵ 2 N 0 N 1 D β + D ˜ β ( log N 1 ) β 1 ,
and
P sup k > N 1 B ¯ k N 0 ( N 0 1 ) B N ( N 1 ) > τ B ϵ 72 C N 0 τ B 2 ϵ 2 N 0 N 1 D β + D ˜ β ( log N 1 ) β 1 ,
where n ϵ , β is defined by (6).
Proof. 
From Theorems 3 and 4, we know that Var A ˜ N 0 ( N 0 1 ) = Var B ˜ N 0 ( N 0 1 ) = C N 0 N 0 < + , E A ˜ N 0 ( N 0 1 ) = A N ( N 1 ) , and E B ˜ N 0 ( N 0 1 ) = B N ( N 1 ) . Meanwhile, since 0 A ˜ N 0 ( N 0 1 ) 1 , 0 B ˜ N 0 ( N 0 1 ) 1 , 0 A N ( N 1 ) 1 and 0 B N ( N 1 ) 1 , we know that τ A 1 and τ B 1 . Thus, by Theorem A2, we obtain (A32) and (A31). □
We next consider the almost sure convergence rate of log B ¯ k A ¯ k : k N . To this end, we introduce the following lemma.
Lemma A6.
Let N 0 Z N with N 0 > 3 . If A > 0 and B > 0 , then for all N 1 N and 1 > ϵ > 0 ,
P sup k > N 1 log A ¯ k N 0 ( N 0 1 ) log A N ( N 1 ) > ϵ P sup k > N 1 A ¯ k N 0 ( N 0 1 ) A N ( N 1 ) > A ϵ N ( N 1 ) e ,
and
P sup k > N 1 log B ¯ k N 0 ( N 0 1 ) log B N ( N 1 ) > ϵ P sup k > N 1 B ¯ k N 0 ( N 0 1 ) B N ( N 1 ) > B ϵ N ( N 1 ) e .
Proof. 
Note that for all 0 < a , b < 1 and 0 < η < 1 , when
log a log b > η ,
it holds that a > b e η , or a < b e η . Hence, when (A35) holds, there is
a b > b ( e η 1 ) , or a b < b ( e η 1 ) .
By noting that e η 1 > 1 e η and 1 e η > e 1 η , from (A36), we know that when (A35) holds, there has a b > b e 1 η , or a b < b e 1 η , that is,
a b > b e 1 η .
Note that when a = 0 , for all 0 < b < 1 and 0 < η < 1 , inequality (A37) always holds. Thus, we know that for all 0 a < 1 and 0 < b , η < 1 , when (A35) holds, inequality (A37) holds. Then, replacing a, b, and η by B ¯ k N 0 ( N 0 1 ) , B N ( N 1 ) and ϵ , we know for all N 1 N and 0 < ϵ < 1 , when
sup k > N 1 log B ¯ k N 0 ( N 0 1 ) log B N ( N 1 ) > ϵ ,
there has
sup k > N 1 B ¯ k N 0 ( N 0 1 ) B N ( N 1 ) > B ϵ N ( N 1 ) e .
Let F 1 be the set of the events satisfying (A38), and F 2 be the set of the events satisfying (A39). From (A38) and (A39), we know that F 1 F 2 . Thus, we can obtain (A34) (see Theorem 1.5.4 in [29]). Similarly, we can obtain (A33). □
Combining Lemmas A5 and A6, we obtain the almost sure convergence rate of
log B ¯ k A ¯ k : k N
in Theorem 5.
The proof of Theorem 5 is provided as follows.
Proof. 
Note that for all N 1 N ,
sup k > N 1 log B ¯ k A ¯ k log B A sup k > N 1 log B ¯ k N 0 ( N 0 1 ) log B N ( N 1 ) + sup k > N 1 log A ¯ k N 0 ( N 0 1 ) log A N ( N 1 ) .
Thus, we know that for all N 1 N and 1 > ϵ > 0 , if
sup k > N 1 log B ¯ k A ¯ k log B A > max { τ A , τ B } ϵ ,
then
sup k > N 1 log B ¯ k N 0 ( N 0 1 ) log B N ( N 1 ) > max { τ A , τ B } ϵ 2 τ B ϵ 2 ,
or
sup k > N 1 log A ¯ k N 0 ( N 0 1 ) log A N ( N 1 ) > max { τ A , τ B } ϵ 2 τ A ϵ 2 .
Let F 1 be the set of the events satisfying (A40), F 2 be the set of the events satisfying (A41), and F 3 be the set of events satisfying (A42). Then, from the above inequalities, we have F 1 F 2 F 3 . Hence, we have P ( F 1 ) P ( F 2 ) + P ( F 3 ) (see Theorems 1.5.4 and 1.5.7 in [29]), that is,
P sup k > N 1 log B ¯ k A ¯ k log B A > max { τ A , τ B } ϵ P sup k > N 1 log B ¯ k N 0 ( N 0 1 ) log B N ( N 1 ) > τ B ϵ 2 + P sup k > N 1 log A ¯ k N 0 ( N 0 1 ) log A N ( N 1 ) > τ A ϵ 2 .
Substituting (A34) and (A33) into above inequality, from Lemma A5 and the definitions of γ A and γ B , we obtain the desired result (7). □

References

  1. Pincus, S.M. Approximate entropy as a measure of system complexity. Proc. Natl. Acad. Sci. USA 1991, 88, 2297–2301. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  2. Richman, J.S.; Moorman, J.R. Physiological time-series analysis using approximate entropy and sample entropy. Am. J. Physiol. Heart Circ. Physiol. 2000, 278, 2039–2049. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  3. Costa, M.; Goldberger, A.L.; Peng, C.-K. Multiscale entropy analysis of complex physiologic time series. Phys. Rev. Lett. 2002, 89, 068102. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  4. Jiang, Y.; Peng, C.-K.; Xu, Y. Hierarchical entropy analysis for biological signals. J. Comp. Appl. Math. 2011, 236, 728–742. [Google Scholar] [CrossRef] [Green Version]
  5. Li, Y.; Li, G.; Yang, Y.; Liang, X.; Xu, M. A fault diagnosis scheme for planetary gearboxes using adaptive multi-scale morphology filter and modified hierarchical permutation entropy. Mech. Syst. Signal Proc. 2017, 105, 319–337. [Google Scholar] [CrossRef]
  6. Yang, C.; Jia, M. Hierarchical multiscale permutation entropy-based feature extraction and fuzzy support tensor machine with pinball loss for bearing fault identification. Mech. Syst. Signal Proc. 2021, 149, 107182. [Google Scholar] [CrossRef]
  7. Li, W.; Shen, X.; Li, Y. A comparative study of multiscale sample entropy and hierarchical entropy and its application in feature extraction for ship-radiated noise. Entropy 2019, 21, 793. [Google Scholar] [CrossRef] [Green Version]
  8. Jiang, Y.; Mao, D.; Xu, Y. A fast algorithm for computing sample entropy. Adv. Adapt. Data Anal. 2011, 3, 167–186. [Google Scholar] [CrossRef]
  9. Mao, D. Biological Time Series Classification via Reproducing Kernels and Sample Entropy. Ph.D. Dissertation, Syracuse University, Syracuse, NY, USA, August 2008. [Google Scholar]
  10. Grassberger, P. An optimized box-assisted algorithm for fractal dimensions. Phys. Lett. A 1990, 148, 63–68. [Google Scholar] [CrossRef]
  11. Theiler, J. Efficient algorithm for estimating the correlation dimension from a set of discrete points. Phys. Rev. A Gen. Phys. 1987, 36, 4456–4462. [Google Scholar] [CrossRef]
  12. Manis, G. Fast computation of approximate entropy. Comput. Meth. Prog. Biomed. 2008, 91, 48–54. [Google Scholar] [CrossRef]
  13. Manis, G.; Aktaruzzaman, M.; Sassi, R. Low computational cost for sample entropy. Entropy 2018, 20, 61. [Google Scholar] [CrossRef] [Green Version]
  14. Wang, Y.H.; Chen, I.Y.; Chiueh, H.; Liang, S.F. A low-cost implementation of sample entropy in wearable embedded systems: An example of online analysis for sleep eeg. IEEE Trans. Instrum. Meas. 2021, 70, 9312616. [Google Scholar] [CrossRef]
  15. Tomčala, J. New fast ApEn and SampEn entropy algorithms implementation and their application to supercomputer power consumption. Entropy 2020, 22, 863. [Google Scholar] [CrossRef] [PubMed]
  16. Shekelyan, M.; Cormode, G. Sequential Random Sampling Revisited: Hidden Shuffle Method. In Proceedings of the 24th International Conference on Artificial Intelligence and Statistics, Virtually Held, 13–15 April 2021; pp. 3628–3636. [Google Scholar]
  17. Karr, A.F. Probability; Springer: New York, NY, USA, 1993. [Google Scholar]
  18. Luzia, N. A simple proof of the strong law of large numbers with rates. Bull. Aust. Math. Soc. 2018, 97, 513–517. [Google Scholar] [CrossRef]
  19. Goldberger, A.L.; Amaral, L.A.; Glass, L.; Hausdorff, J.M.; Ivanov, P.C.; Mark, R.G.; Mietus, J.E.; Moody, G.B.; Peng, C.-K.; Stanley, H.E. Physiobank, physiotoolkit, and physionet: Components of a new research resource for complex physiologic signals. Circulation 2000, 101, 215–220. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  20. Shao, S.; McAleer, S.; Yan, R.; Baldi, P. Highly accurate machine fault diagnosis using deep transfer learning. IEEE Trans. Ind. Inform. 2019, 15, 2446–2455. [Google Scholar] [CrossRef]
  21. Case Western Reserve University Bearing Data Center. Available online: https://engineering.case.edu/bearingdatacenter (accessed on 27 March 2022).
  22. Royal Netherlands Meteorological Institute. Available online: https://www.knmi.nl/nederland-nu/klimatologie/uurgegevens (accessed on 27 March 2022).
  23. Petrutiu, S.; Sahakian, A.V.; Swiryn, S. Abrupt changes in fibrillatory wave characteristics at the termination of paroxysmal atrial fibrillation in humans. Europace 2007, 9, 466–470. [Google Scholar] [CrossRef]
  24. Jager, F.; Taddei, A.; Moody, G.B.; Emdin, M.; Antolič, G.; Dorn, R.; Smrdel, A.; Marchesi, C.; Mark, R.G. Long-term st database: A reference for the development and evaluation of automated ischaemia detectors and for the study of the dynamics of myocardial ischaemia. Med. Biol. Eng. Comput. 2003, 41, 172–182. [Google Scholar] [CrossRef]
  25. Baim, D.S.; Colucci, W.S.; Monrad, E.S.; Smith, H.S.; Wright, R.F.; Lanoue, A.; Gauthier, D.F.; Ransil, B.J.; Grossman, W.; Braunwald, E. Survival of patients with severe congestive heart failure treated with oral milrinone. J. Am. Coll. Cardiol. 1986, 7, 661–670. [Google Scholar] [CrossRef] [Green Version]
  26. Welch, J.; Ford, P.; Teplick, R.; Rubsamen, R. The massachusetts general hospital-marquette foundation hemodynamic and electrocardiographic database–comprehensive collection of critical care waveforms. Clin. Monit. 1991, 7, 96–97. [Google Scholar]
  27. Shoeb, A.H. Application of Machine Learning to Epileptic Seizure Onset Detection and Treatment. Ph.D. Thesis, Massachusetts Institute of Technology, Cambridge, MA, USA, September 2009. [Google Scholar]
  28. Silva, L.E.V.; Filho, A.C.S.S.; Fazan, V.P.S.; Felipe, J.C.; Junior, L.O.M. Two-dimensional sample entropy: Assessing image texture through irregularity. Biomed. Phys. Eng. Expr. 2016, 2, 045002. [Google Scholar] [CrossRef]
  29. DeGroot, M.H.; Schervish, M.J. Probability and Statistics, 4th ed.; Person Education: New York, NY, USA, 2012. [Google Scholar]
Figure 1. Samples of the dataset records.
Figure 1. Samples of the dataset records.
Entropy 24 00524 g001
Figure 2. The values of M e a n E r r and R M e a n S q E r r for time series “mghdb/mgh001” with respect to the sample size N 0 and the number of computations N 1 , where parameters r = 0.15 and m = 4 , 5 . (a) M e a n E r r with m = 4 . (b) R M e a n S q E r r with m = 4 . (c) M e a n E r r with m = 5 . (d) R M e a n S q E r r with m = 5 .
Figure 2. The values of M e a n E r r and R M e a n S q E r r for time series “mghdb/mgh001” with respect to the sample size N 0 and the number of computations N 1 , where parameters r = 0.15 and m = 4 , 5 . (a) M e a n E r r with m = 4 . (b) R M e a n S q E r r with m = 4 . (c) M e a n E r r with m = 5 . (d) R M e a n S q E r r with m = 5 .
Entropy 24 00524 g002
Figure 3. The values of M e a n E r r and R M e a n S q E r r with respect to N 0 { 200 i : i Z 20 + } and N 1 = 150 , where parameters r = 0.15 and m = 4 , 5 . (a) M e a n E r r with m = 4 . (b) R M e a n S q E r r with m = 4 . (c) M e a n E r r with m = 5 . (d) R M e a n S q E r r with m = 5 .
Figure 3. The values of M e a n E r r and R M e a n S q E r r with respect to N 0 { 200 i : i Z 20 + } and N 1 = 150 , where parameters r = 0.15 and m = 4 , 5 . (a) M e a n E r r with m = 4 . (b) R M e a n S q E r r with m = 4 . (c) M e a n E r r with m = 5 . (d) R M e a n S q E r r with m = 5 .
Entropy 24 00524 g003
Figure 4. The values of M e a n E r r and R M e a n S q E r r with respect to N 0 = 2 × 10 3 and N 1 { 10 i : i Z 25 + } , where parameters r = 0.15 and m = 4 , 5 . (a) M e a n E r r with m = 4 . (b) R M e a n S q E r r with m = 4 . (c) M e a n E r r with m = 5 . (d) R M e a n S q E r r with m = 5 .
Figure 4. The values of M e a n E r r and R M e a n S q E r r with respect to N 0 = 2 × 10 3 and N 1 { 10 i : i Z 25 + } , where parameters r = 0.15 and m = 4 , 5 . (a) M e a n E r r with m = 4 . (b) R M e a n S q E r r with m = 4 . (c) M e a n E r r with m = 5 . (d) R M e a n S q E r r with m = 5 .
Entropy 24 00524 g004
Figure 5. The values of R M e a n S q E r r with respect to p, where parameters r = 0.15 , m = 4 , 5 , N = 2 20 , N 0 = 2000 , and N 1 = 150 .
Figure 5. The values of R M e a n S q E r r with respect to p, where parameters r = 0.15 , m = 4 , 5 , N = 2 20 , N 0 = 2000 , and N 1 = 150 .
Entropy 24 00524 g005
Figure 6. The left column shows the results of computational time versus data length N on different signals. In the right column, the values of R M e a n S q E r r are presented by error bars “I”, where the larger the value of R M e a n S q E r r , the longer the error bar “I”. In this figure, we set m = 4 , 5 , N 0 = 2 × 10 3 , and N 1 = 150 . (a) Time for “ltafdb/00”. (b) Sample entropy “ltafdb/00”. (c) Time for 1 / f noise. (d) Sample entropy for 1 / f noise. (e) Time for “chbmit/chb07_01”. (f) Sample entropy for “chbmit/chb07_01”. (g) Time “ltecg/14046”. (h) Sample entropy for “ltecg/14046”.
Figure 6. The left column shows the results of computational time versus data length N on different signals. In the right column, the values of R M e a n S q E r r are presented by error bars “I”, where the larger the value of R M e a n S q E r r , the longer the error bar “I”. In this figure, we set m = 4 , 5 , N 0 = 2 × 10 3 , and N 1 = 150 . (a) Time for “ltafdb/00”. (b) Sample entropy “ltafdb/00”. (c) Time for 1 / f noise. (d) Sample entropy for 1 / f noise. (e) Time for “chbmit/chb07_01”. (f) Sample entropy for “chbmit/chb07_01”. (g) Time “ltecg/14046”. (h) Sample entropy for “ltecg/14046”.
Entropy 24 00524 g006
Figure 7. The left column shows the results of computational time versus data length N on different signals. The right column shows the values of R M e a n S q E r r by error bar, where the larger the value of R M e a n S q E r r , the longer the error bar “I”. In this figure, we set m = 4 , 5 , N 0 = max { 1024 , N } , and N 1 = max { 1 , N / N 0 } . (a) Time for “ltafdb/00”. (b) Sample entropy “ltafdb/00”. (c) Time for 1 / f noise. (d) Sample entropy for 1 / f noise. (e) Time for “chbmit/chb07_01”. (f) Sample entropy for “chbmit/chb07_01”. (g) Time “ltecg/14046”. (h) Sample entropy for “ltecg/14046”.
Figure 7. The left column shows the results of computational time versus data length N on different signals. The right column shows the values of R M e a n S q E r r by error bar, where the larger the value of R M e a n S q E r r , the longer the error bar “I”. In this figure, we set m = 4 , 5 , N 0 = max { 1024 , N } , and N 1 = max { 1 , N / N 0 } . (a) Time for “ltafdb/00”. (b) Sample entropy “ltafdb/00”. (c) Time for 1 / f noise. (d) Sample entropy for 1 / f noise. (e) Time for “chbmit/chb07_01”. (f) Sample entropy for “chbmit/chb07_01”. (g) Time “ltecg/14046”. (h) Sample entropy for “ltecg/14046”.
Entropy 24 00524 g007
Figure 8. The results of computational time with respect to p, where parameters r = 0.15 , m = 4 , 5 , N = 2 20 , N 0 , and N 1 are selected such that relative error R M e a n S q E r r / S a m p E n 0.02 .
Figure 8. The results of computational time with respect to p, where parameters r = 0.15 , m = 4 , 5 , N = 2 20 , N 0 , and N 1 are selected such that relative error R M e a n S q E r r / S a m p E n 0.02 .
Entropy 24 00524 g008
Figure 9. The results of memory usage versus data length N with m = 4 , 5 . (a) Memory usage for m = 4 . (b) Memory usage for m = 5 .
Figure 9. The results of memory usage versus data length N with m = 4 , 5 . (a) Memory usage for m = 4 . (b) Memory usage for m = 5 .
Entropy 24 00524 g009
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Liu, W.; Jiang, Y.; Xu, Y. A Super Fast Algorithm for Estimating Sample Entropy. Entropy 2022, 24, 524. https://doi.org/10.3390/e24040524

AMA Style

Liu W, Jiang Y, Xu Y. A Super Fast Algorithm for Estimating Sample Entropy. Entropy. 2022; 24(4):524. https://doi.org/10.3390/e24040524

Chicago/Turabian Style

Liu, Weifeng, Ying Jiang, and Yuesheng Xu. 2022. "A Super Fast Algorithm for Estimating Sample Entropy" Entropy 24, no. 4: 524. https://doi.org/10.3390/e24040524

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop