{'fraction_non_alphanumeric': 0.04577683240272977, 'fraction_numerical': 0.019764247097403174, 'mean_word_length': 4.502804194099, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Refined Composite Multiscale Dispersion Entropy and its Application to Biomedical Signals

Multiscale entropy (MSE) is a widely-used tool to analyze biomedical signals. It was proposed to overcome the deficiencies of conventional entropy methods when quantifying the complexity of time series. However, MSE is undefined for very short signals and slow for real-time applications because of the use of sample entropy (SampEn). To overcome these shortcomings, we introduce multiscale dispersion entropy (DisEn - MDE) as a very fast and powerful method to quantify the complexity of signals. MDE is based on our recently developed DisEn, which has a computation cost of O(N), compared with O(N2) for SampEn. We also propose the refined composite MDE (RCMDE) to improve the stability of MDE. We evaluate MDE, RCMDE, and refined composite MSE (RCMSE) on synthetic signals and find that these methods have similar behaviors but the MDE and RCMDE are significantly faster than MSE and RCMSE, respectively. The results also illustrate that RCMDE is more stable than MDE for short and noisy signals, which are common in biomedical applications. To evaluate the proposed methods on real signals, we employ three biomedical datasets, including focal and non-focal electroencephalograms (EEGs), blood pressure recordings in Fantasia database, and resting-state EEGs activity in Alzheimer's disease (AD). The results again demonstrate a similar behavior of RCMSE, MDE and RCMDE, although the RCMDE and MDE are significantly faster and lead to larger differences between physiological conditions known to alter the complexity of the physiological recordings. To sum up, MDE and RCMDE are expected to be useful for the analysis of physiological signals thanks to their ability to distinguish different types of dynamics.


I. INTRODUCTION
E NTROPY is an effective and broadly used method to measure the irregularity, unpredictability, or uncertainty of systems or time series [1] [2]. Higher entropy shows higher uncertainty, while lower entropy stands for less irregularity or uncertainty of a signal [3]. When dealing with biomedical signals, two of the most common entropy estimators are sample entropy (SampEn) [2] and permutation entropy (PerEn) [4].
SampEn denotes the negative natural logarithm of the conditional probability that a signal of length N , having repeated itself within a tolerance r for m sample points, will also repeat for m + 1 sample points [2]. For more information about SampEn, please refer to [2]. In spite of its advantages over other entropy methods, SampEn has a computation cost of O(N 2 ) [5], [6].
PerEn, as a fast and powerful symbolization method, is based on the permutation patterns or the order relations of the amplitude values of a signal [4]. PerEn has been broadly used in many signal processing applications, because it is computationally quick and has a computation cost of O(N) [6]. Nevertheless, it has two key deficiencies: 1) when a time series is symbolized using the Bandt-Pompe algorithm, only the order of the amplitude values is noticed and some information about the amplitude values is ignored 2) the impact of equal amplitude values in each embedding vector was not addressed in PerEn [7]. While modified PerEn (MPerEn) has been recently introduced [8] to address point 2) and weighted PerEn (WPerEn) [9] to address 1), none of them addresses both shortcomings.
To alleviate the deficiencies of PerEn, WPerEn, MPerEn, and SampEn, we proposed a new entropy method, named dispersion entropy [1]. DisEn needs to neither sort the amplitude values of each embedding vector nor calculate every distance between any two composite delay vectors with embedding dimensions m and m + 1. This makes DisEn significantly faster than PerEn, WPerEn, MPerEn, and SampEn and it has a computation cost of O(N). DisEn overcomes the problem of equal values for embedding vectors and discarding some information with regard to the amplitudes for PerEn [1], [7]. Finally, unlike PerEn, MPerEn, and WPerEn, DisEn is relatively insensitive to noise, because a small change in amplitude value will not vary its class label [1]. The results demonstrated that DisEn, unlike PerEn, WPerEn, and MPerEn, is sensitive to changes in simultaneous frequency and amplitude values and bandwidth of signals [1]. We also showed that DisEn outperformed PerEn in the discrimination of different groups of biomedical datasets.
Nevertheless, conventional entropy methods, such as Sam-pEn, PerEn, and DisEn, are maximized for completely random processes and are utilized to quantify the regularity of signals on a single scale, by e.g., assessing repetitive patterns [10]. To quantify the complexity of signals over multiple temporal scales, multiscale entropy (MSE) [10] and multiscale PerEn (MPE) [11] were proposed. The MSE method is powerful to characterize the biomedical signals to detect different patho-logical states such as schizophrenia, Alzheimer's disease (AD), and Parkinson's disease [12]- [14].
It is worth mentioning that, here, the complexity concept stands for meaningful structural richness, which may be in contrast with regularity measures defined from classical entropy approaches such as SampEn, PerEn and DisEn [15]. In fact, a completely ordered system with a small entropy value or a completely disordered system with maximum entropy value is the least complex [15]- [17]. For example, white Gaussian noise (WGN) is more irregular than 1/f noise although the latter is more complex, because 1/f noise contains long-range correlations and its 1/f decay produces a fractal structure in time [15]- [17]. Note that MPE, though widespread, does not follow the concept of complexity for WGN and 1/f noise [6]. In the physiologic complexity literature, healthy systems or people correspond to more complex states due to their ability to adapt themselves in response to adverse conditions, exhibiting long range correlations and complex variability at multiple scales, while aged and diseased systems or individuals present complexity loss. That is, they lose the capability to adapt to such adverse conditions [15].
To increase the accuracy of entropy estimation and decrease the probability of inducing undefined entropy, refined composite MSE (RCMSE) was proposed [18]. However, it is not quick enough for some applications and the computational cost is O(N 2 ) [6]. Building on these trends and the advantages of DisEn over PerEn and SampEn [1], here we introduce multiscale DisEn (MDE) and its improved version, i.e., refined composite MDE (RCMDE), as a fast and powerful complexity estimator for real world signals. We exemplify the behavior of MDE and RCMDE for two kinds of classical signal concepts (noise and non-linearity) to demonstrate the dependency of the MDE and RCMDE algorithms on these concepts. Finally, we show their application to three real biomedical datasets: focal and non-focal electroencephalograms (EEGs), blood pressure recordings in Fantasia database, and resting-state EEGs activity in AD.

A. Multiscale Dispersion Entropy (MDE)
The MDE is not a naive combination of the coarse-graining [10] with DisEn. Instead, crucially, the mapping based on the normal cumulative distribution function (NCDF) used in the calculation of DisEn [1] for the first temporal scale is maintained across all scales. In fact, in the MDE and RCMDE, µ and σ of NCDF are respectively set at the average and standard deviation (SD) of the original signal and they remain constant for all scale factors. This fact is similar to r in the MSE-based algorithms, setting at a certain percentage (usually 15%) of the SD of the original signal and remaining constant for all scales [10].
Assume we have a univariate signal of length L: u = {u 1 , u 2 , ..., u L }. In the MDE algorithm, the original signal u is first divided into non-overlapping segments of length τ , named scale factor. Then, the average of each segment is calculated to derive the coarse-grained signals as follows [10]: Finally, the entropy value, using DisEn, is calculated for each coarse-grained signal. The DisEn of the univariate time series of length N : x = {x 1 , x 2 , ..., x N } is defined as follows: 1) First, x j (j = 1, 2, ..., N ) are mapped to c classes with integer indices from 1 to c. To this end, the NCDF is first used to overcome the problem of assigning the majority of x i to only few classes in case maximum or minimum values are noticeable larger or smaller than the mean/median value of the signal. The NCDF maps x into y = {y 1 , y 2 , ..., y N } from 0 to 1 as follows: where σ and µ are the SD and mean of time series x, respectively. Then, we use a linear algorithm to assign each y i to an integer from 1 to c. To do so, for each member of the mapped signal, we use z c j = round(c.y j + 0.5), where z c j denotes the j th member of the classified time series and rounding involves either increasing or decreasing a number to the next digit [1]. Note that, although this part is linear, the whole mapping approach is non-linear because of the use of the NCDF.
The number of possible dispersion patterns that can be assigned to each time series z m,c i is equal to c m , since the signal has m members and each member can be one of the integers from 1 to c [1].
3) For each c m potential dispersion patterns π v0v1...vm−1 , relative frequency is obtained as follows: In fact, p(π v0v1...vm−1 ) shows the number of dispersion patterns of π v0v1...vm−1 that is assigned to z m,c i , divided by the total number of embedded signals with embedding dimension m.
4) Finally, based on the Shannon's definition of entropy, the DisEn value is calculated as follows: When all possible dispersion patterns have equal probability value, the highest value of DisEn is obtained, which has a value of ln(c m ). In contrast, if there is only one p(π v0v1...vm−1 ) different from zero, which demonstrates a completely regular/predictable time series, the smallest value of DisEn is obtained [1].

B. Refined Composite Dispersion Entropy (RCMDE)
In RCMDE, for scale factor τ , τ different time series, corresponding to different starting points of the coarse graining process are created and the RCMDE value is defined as the Shannon entropy value of the averages of the dispersion patterns of those shifted sequences. The k th coarse-grained time series x ..} of u is as follows: Then, for each scale factor, RCMDE is defined as follows: with the relative frequency of the dispersion pattern π in the series x τ k .

C. Parameters of the (Refined Composite) Multiscale Dispersion Entropy
There are four parameters for MDE, including the embedding dimension m, the number of classes c, the time delay d, and the maximum scale factor τ max . In practice, it is recommended d = 1, because some information with regard to the frequency may be ignored for 1 < d, something that might lead to aliasing [1]. Clearly, we need 1 < c in order to avoid the trivial case of having only one dispersion pattern. For MDE and RCMDE, here, we use c = 6 for all signals according to [1], although the range 2 < c < 9 leads to similar results. For more information about c, m, and d, please refer to [1]. To work with reliable statistics to calculate DisEn, it was recommended that the number of potential dispersion patterns is smaller than the length of the signal (c m < L) [1]. For MDE, since the coarse-graining process causes the length of a signal decrease to L τmax , it is recommended c m < L τmax . In RCDME, we consider τ coarse-grained time series with length L τmax . Therefore, the total sample points calculated in RCMDE is τ × L τmax ≈ L. Thus, the RCMDE follows c m < L, leading to more reliable results, especially for short signals.

III. EVALUATION SIGNALS
In this section, we briefly explain the synthetic and real signals used in this study.
2) To understand the relationship between MDE, RCMDE, and RCMSE, and the level of noise affecting quasi-periodic time series, we generated an amplitude-modulated quasiperiodic time series with additive WGN of diverse power. First, we created signal as an amplitude-modulated sum of two cosine waves with frequencies at 0.5 Hz and 1 Hz. The length and the sampling frequency of the signal are 100 s and 150 Hz, respectively. The first 20 s of this series (100 s) does not have any noise. Then, WGN was added to the time series [20].
3) To find the dependence of MDE, RCMDE, and RCMSE with changes from periodicity to non-periodic non-linearity, a logistic map is used. This analysis is relevant to the model parameter α as: u k = αu k−1 (1 − u k−1 ), where the signal x was generated varying the parameter α from 3.5 to 3.99. When α is equal to 3.5, the signal oscillated among four values. For 3.5 < α < 3.57, the time series is periodic and the number of values doubles progressively. For α between 3.57 and 3.99, the time series is chaotic, although it has windows of periodic behavior (e.g., 3.8) [21]- [23]. Note that the signal has a length of 100 s with the sampling frequency of 150 Hz.

B. Real Biomedical Datasets
EEG and blood pressure recordings are affordable, noninvasive, and widely-used to detect different physiological states [3], [24]. Using these signals, we employ RCMDE and MDE to discriminate focal signals from non-focal ones, elderly from young subjects, and AD patients from controls, as three broadly-used applications in complexity-based methods.
1) Dataset of Focal and Non-focal Brain Activity: The ability of RCMDE and MDE to discriminate focal signals from non-focal ones is evaluated by the use of a publicly-available EEG dataset [25]. The dataset includes 5 patients and, for each patient, there are 750 focal and 750 non-focal time series. The length of each signal was 20 s with sampling frequency of 512 Hz (10240 sample points). For more information about the dataset, please, refer to [25]. Before computing the abovementioned methods, all time series were digitally filtered employing an FIR band-pass filter with cut-off frequencies at 0.5 Hz and 40 Hz.
2) Fantasia Dataset of Blood Pressure Recordings: To further evaluate MDE and RCMDE, we use uncalibrated continuous non-invasive blood pressure recordings of the Fantasia database [24]. This included 10 young (21-34 years old) and 10 old (68-85 years old), rigorously-screened healthy individuals. Each group consisted of 5 women and 5 men. All 20 individuals remained in an inactive state in sinus rhythm when watching the movie Fantasia (Disney, 1940) to help maintain wakefulness. For each subject, the signal was digitized at 250 Hz (1,000,000 samples) [24]. Further information can be found in [24].
3) Surface EEG Dataset of Brain Activity in Alzheimer's Disease: The dataset includes 11 AD patients (5 men; 6 women; age: 72.5 ± 8.3 years, mean ± SD; mini mental state examination (MMSE): 13.3 ± 5.6, mean ± SD) and 11 age-matched control subjects (7 men; 4 women; age: 72.8 ± 6.1 years, mean ± SD; MMSE: 30 ± 0, mean ± SD) [26] [27]. The EEG signals were recorded using the international 10-20 system, in an eyes closed and resting state with a sampling frequency of 256 Hz from the Alzheimer's Patients Relatives Association of Valladolid, Spain. Informed consent was obtained for all 22 subjects and the local ethics committee approved the study. A specialist clinician selected 5 s epochs (1280 sample points) with minimal artifacts for analysis. More details can be found in [26], [27]. Before analysis, all EEG time series were digitally filtered with a band-pass filter with cut-off frequencies at 0.5 Hz and 40 Hz to remove residual electromyographic activity. Fig. 1(a), 1(b), and 1(c) respectively show the results obtained for MDE, RCMDE, and RCMSE using 40 different WGN and 1/f noise signals with the length of 20,000 samples. All the results are consistent with the fact that 1/f noise has more complex structure than and WGN is more irregular than 1/f noise [10], [16], [17]. At short scale factors, the entropy values of WGN signals are higher than those of 1/f noise. However, at higher scale factors, the entropy value for the coarse-grained 1/f noise signal stays almost constant, while for the coarse-grained WGN signal monotonically decreases. For WGN, when the length of the signal, obtained by the coarse-graining process, decreases (i.e., the scale factor increases), the mean value of inside each signal converges to a constant value and the SD becomes smaller. Therefore, no new structures are revealed on higher scales. This demonstrates WGN time series contain information only in small time scales [15] [17]. The SD values of RCMDE results are smaller than those of MDE ones. For example, at scale factor 20, the SD of the MDE-based results for WGN and 1/f noise respectively are 0.065 and 0.027, in comparison with RCMDEbased method with SD 0.031 and 0.014 for WGN and 1/f , respectively. This fact shows that the RCMDE leads to more stable results, in comparison with MDE.

A. Synthetic Signals
For all MSE-based methods, we set d = 1, m = 2, and r = 0.15% of the SD of the original signal [2]. The maximum scale factor for MSE and RCMSE follows [15], [18]. Here, for WGN and 1/f noise, τ max and m respectively were 20 and 2 for MDE and RCMDE, according to Section II.C.
To evaluate the computation time of MSE (with m=1 and 2 for completeness), MDE (m=2 and 3, likewise), RCMSE (m=2), and RCMDE (m=3), we use WGN signals with different lengths, changing from 100 to 100,000 sample points. The results are shown in TABLE I. The simulations have been carried out using a PC with Intel (R) Xeon (R) CPU, E5420, 2.5 GHz and 8-GB RAM by MATLAB R2015a. For 100 and The multiscale methods are applied to the logistic map and quasi-periodic signals with additive noise using a moving window of 1500 samples (10 s) with 90% overlap. Here, for MDE and RCMDE, τ max and m respectively were 15 and 2, according to Section II.C. Fig. 2(a) shows the MDE-, RCMDE-and RCMDE-based using the quasi-periodic signal with increasing additive noise power. As expected, the entropy values for all three methods increase along the signal. At high scale factors, the entropy values decrease because of the filtering nature of coarse-graining process. To sum up, The results using the logistic map with the parameter α changing linearly from 3.5 to 3.99 with MDE, RCMDE, and RCMSE are shown in Fig 2(b)(left), 2(b)(middle), and 2(c)(right), respectively. As expected, the entropy values, obtained by the MDE, RCMDE, and RCMSE, generally rise along the signal, except for the downward spikes in the windows of periodic behavior. This fact is in agreement with Fig. 4.10 (page 87 in [21]). In case of increasing scale factor, MDE, RCMDE and RCMSE lead to an increase until τ = 2 and τ = 3, respectively, then a decrease. The results show that all the methods lead to the similar results. In particular, there is little difference between MDE and RCMDE. It shows when signals do not have noticeable noise, MDE and RCMDE have quite similar performance, although MDE is significantly faster due to avoiding having to repeat the coarse-graining process within each temporal scale.

1) Dataset of Focal and Non-focal Brain Activity:
For the focal and non-focal EEG dataset, the results obtained by MDE, RCMDE, and RCMSE, respectively, depicted in Fig. 3 (a), (b), and, (c) show that non-focal signals are more complex than focal ones. This fact is in agreement with previous studies [25] [28]. The results show the MDE, RCMDE, and RCMSE lead to similar results, albeit the MDE-based methods are significantly faster than MSE-based ones. Note that, for MDE and RCMDE, τ max and m respectively were 30 and 3.
2) Fantasia Dataset of Blood Pressure Recordings: In Fig.  4, the error bars show the spread of the MDE, RCMDE, and RCMSE values computed from young and old subjects' blood pressure recordings in the Fantasia database. For each scale factor, the average of entropy values for elderly subjects are smaller than that for young ones using MDE, RCMDE, and RCMSE, in agreement with those obtained by the other entropy-based method [29]. For RCMDE, τ max and m respectively were 20 and 4, as outlined before. The computational time for the MDE, RCMDE and RCMSE results were about 1 hour, 5 hours, and 10 days, respectively. This considerable differences are due to the length of the signals (1,000,000 samples). For each scale factor and for each of MDE, RCMDE, and RCMSE, a Student's t-test was also used to assess the statistical differences between the DisEn/SampEn values for young subjects versus elderly ones at all considered temporal scales. We adjusted the false discovery rate (FDR) indepen-     [31]. Moreover, a Student's t-test was performed for AD patients' vs. controls' recordings. We adjusted the FDR independently for each of MDE, RCMDE, and RCMSE and each scale factor. As can be seen in Fig. 5, the results show that the MDE and RCMDE methods achieve very significant differences at scale factors 2, 3, 4, 5, 6, 11, and 12 and significant differences at scales 1 and 10, while the RCMSE leads to very significant differences at only scale factors 11 and 12 and a significant difference at scale factor 10. This suggests a better performance of the MDE and RCMDE approaches over the RCMSE algorithm for the distinction of EEG background activity related to AD. Overall, the results of the three real world datasets support the use of MDE and RCMDE over RCMSE due to its ability to produce similar complexity profiles, faster computational time and increased ability to find differences between physiological conditions. In future work, we will introduce multivariate MDE (mvMDE) and refined composite mvMDE.

V. CONCLUSIONS
We introduced MDE and RCMDE to quantify the complexity of signals and evaluated their performance on several relevant synthetic signals and three physiological datasets. The results showed similar behavior in terms of complexity profiles of MSE or RCMSE and MDE or RCMDE although the MDE and RCMDE are significantly faster, especially for long signals. Moreover, RCMDE was more stable than MDE for noisy signals, while for filtered biomedical signals, the performance of RCMDE and MDE was quite similar. For short signals, MDE and RCMDE, unlike MSE and RCMSE, did not lead to undefined values. In comparison with RCMSE, MDE and RCMDE discriminated better the elderly from young subjects and controls from AD patients, respectively, for Fantasia and AD datasets. All in all, we expect MDE and RCMDE to play a prominent role in the evaluation of complexity in real signals.