Determination of Parameters for an Entropy-Based Atrial Fibrillation Detector

Entropy algorithm is an important nonlinear method for cardiovascular disease detection due to its power in analyzing short-term time series. In previous a study, we proposed a new entropy-based atrial fibrillation (AF) detector, i.e., EntropyAF, which showed a high classification accuracy in identifying AF and non-AF rhythms. As a variation of entropy measures, EntropyAF has two parameters that need to be initialized before the calculation: (1) tolerance threshold r and (2) similarity weight n. In this study, a comprehensive analysis for the two parameters determination was presented, aiming to achieve a high detection accuracy for AF events. Data were from the MIT-BIH AF database. RR interval recordings were segmented using a 30-beat time window. The parameters r and n were initialized from a relatively small value, then gradually increased, and finally the best parameter combination was determined using grid searching. AUC (area under curve) values from the receiver operator characteristic curve (ROC) were compared under different parameter combinations of parameters r and n, and the results demonstrated that the selection of these two parameters plays an important role in AF/non-AF classification. Small values of parameters r and n can lead to a better detection accuracy than other selections. The best AUC value for AF detection was 98.15%, and the corresponding parameter combinations for EntropyAF were as follows: r = 0.01, n = 0.0625, 0.125, 0.25, or 0.5; r = 0.05 and n = 0.0625, 0.125, or 0.25; and r = 0.10 and n = 0.0625 or 0.125.


Introduction
Atrial fibrillation (AF) is a one of the most common arrhythmias, and usually refers to the rapid and irregular fibrillation of the atrium [1]. AF is an important inducement of cardiovascular events such as stroke, heart failure, and sudden death, and has a high morbidity and mortality [2,3]. The incidence of AF is high, and currently ranges from 2% to 4% adults [4]. However, as the symptoms of AF are always brief and weak or even be asymptomatic [5], the diagnosis for AF is relatively difficult, so timely and accurate detection of AF is therefore challenging [6].
The commonly used Holter monitor may miss many cases of paroxysmal AF [7], so the recently developed wearable and long-term electrocardiogram (ECG) monitoring strategies need to have the capability to scan AF and AF-related complications [8,9], which will require a more robust AF detector. There are normally two kinds of approaches for AF scanning-atrial activity analysis-based and ventricular response analysis-based methods [10]. The atrial activity analysis-based method analyses P waves or detects f waves in the ECG data [11][12][13], which requires high quality ECG signals [14]. The ventricular response analysis-based method analyses the irregularity of RR intervals, and has a relatively better tolerance for signal quality, and therefore can be more suitable for AF scanning in the daily environment. Many AF detectors have been proposed in the past few decades, like density histograms [15], Poincaré plot [16], and median absolute deviation [17], as well as various entropy methods [10,18].
Entropy refers to the degree of regularity or irregularity in a time series, and many AF detectors have been proposed based on entropy methods, such as sample entropy (SampEn) [19,20], coefficient of sample entropy (COSEn) [21], and fuzzy measure entropy (FuzzyMEn) [10,22]. All of these methods use the Chebyshev distance to quantify the similarity of two vectors, and thus have some limitations. First, the Chebyshev distance has not been normalized and thus has no upper limit, resulting in uncertainty in the entropy values. Second, the Chebyshev distance only considers the maximum distance between two vectors, ignoring the detailed distance information. To solve these problems, a range function was proposed by Omidvarnia et al. in a new defined range entropy (RangeEn) [23]. In a previous study, we combined the concepts of range function and the advantages of COSEn and FuzzyMEn, and thus proposed an entropy-based AF detector, named Entropy AF [24], which has a better discrimination ability for identifying the AF rhythm from the normal sinus rhythm, for both the MIT-BIH AF database and the clinical wearable AF database.
There are three parameters that need to be initialized in the Entropy AF calculation: (1) embedding dimension m, (2) tolerance threshold r, and (3) similarity weight n. Parameter m determines the length of vectors to be compared, parameter r is a distance threshold for accepting similar patterns between two vectors, and parameter n is a weight for similarity. Parameter m depends on the length of time series, and in the current study, as the RR interval time series for the AF rhythm analysis is limited to 30 RR interval segments, parameter m was set as 1 according to the previous recommendation [21]. So, how to choose the two remaining parameters r and n is a problem that needs to be solved urgently. This study addressed the issue and tested the effect on different combinations of the two parameters on the accuracy of detecting the AF rhythm. The test was performed on an openaccess MIT-BIH AF database in order to determine the optimal parameter combination.

Data
All data used were from the MIT-BIH AF database, which included 25 long-term ECG recordings, with the detailed QRS position and beat annotation files. Each of the recordings was 10 h, and the rhythm annotations were given from the original MIT-BIH AF database, with the expert manual review for verifying four types of rhythm changes: AF (atrial fibrillation), AFL (atrial flutter), J (AV junctional rhythm), and N (used to indicate all other rhythms). Each recording included multiple rhythm segmentations, which are named rhythm episodes herein. The rhythm episodes corresponding to the four rhythm types (AF, AFL, J, and N) were extracted from all 25 recordings, and their number and duration information are shown in Table 1, as well as the corresponding number information of RR intervals. In addition, a 30-beat window length (i.e., 30 RR intervals) was used to segment the rhythm episode without overlap, generating the corresponding RR segments. Table 1 also shows the number of RR segments after the segmenting procedures. From Table 1, it is worth noting that the 30-beat RR segments, whether in AF rhythm and N rhythm (42.6% vs. 54.3%), or in AF rhythm and non-AF rhythm (42.6% vs. 57.4%), reported a nearly 1:1 balanced distribution.

Entropy AF Method
For an RR time series where the vector X m i represents m consecutive x(i). The distance between vector sequences X m i and X m j is normalized and defined as follows: where ε is a small positive number to avoid the possible denominator of 0. Then, we calculate the similarity degree DX m i,j (n, r) between the vectors X m i and X m j by a fuzzy function uX dX m i,j , n, r , defined as follows: where n is the similarity weight and r is the tolerance threshold. We define the functions BX m (n, r) as follows: BX m (n, r) measures the mean similarity degrees for the vectors at dimension m. Similarly, we define the functions of mean similarity degrees AX m+1 (n, r) for dimension m + 1 as follows: Then, we use a density-based estimation, rather than a probability-based estimation, to generate a quadratic fuzzy AF entropy using the volume of each matching region, i.e., (2r) m , as follows: We also subtract the natural log of the mean RR interval as follows: where RR mean is the mean of RR intervals in the current RR segment r and RR mean are expressed in units of s. As shown in Equation (7), directly subtracting the item of ln(RR mean ) is arbitrary. Lastly, we use a weight to optimize the effect of mean RR interval on the final entropy output, as follows: where w is a weight for optimization, and is set as w = 0.8 from our previous study [24].

Parameter Test
Data pre-processing was previously performed on the classified RR episodes. We first segmented the RR intervals into RR segments with a 30-beat window length without overlap. Classification was performed between AF and non-AF rhythm types, the RR segments corresponding to the N, AFL, and J types were merged as non-AF rhythms. The classifier accuracy was assessed via area under curve (AUC) values from the receiver operator characteristic curve (ROC). The ROC curve was a plot of (Se) versus (1 − Sp) for many possible values, which varied from the minimum to the maximum of the entropy outputs, with a step of 1% of the range. Here, Se means sensitivity: Se = TP/(TP + FN), Sp means specificity: Sp = TN/(TN + FP), where TP, TN, FP, and FN are the numbers of true positives, true negatives, false positives, and false negatives, respectively.
The Entropy AF value was calculated under different parameter settings. The criterion for achieving maximal ROC was used for optimizing the parameters r and n. In addition, the selection of m might depend on the time series length N and, as suggested from the previous studies [25][26][27][28], parameters m and N should meet the requirement of N ≈ 10 m ∼ 10 m+1 . Thus, the embedding dimension m was set as 1 due to the short RR segments (30 RR intervals length).
To present the results, histograms of the Entropy AF values were firstly plotted to form a straightforward observation under the representative parameter combinations. Then, the overview of AUC results for classifying AF and non-AF rhythm types was presented. Finally, an inferential analysis of the effect of parameter combination on the entropy output was conducted using an in-depth analysis of the vector distance calculation in Entropy AF .  Figure 1 shows the results when r is set as 0.05 and n varies from 0.125 to 4. We can observe that the distribution of Entropy AF values for AF and non-AF segments separates differently when using different n values. The separation between the two groups with small values (n = 0.125 or 0.5) is more visually obvious than that with large values (n = 2 or 4), indicating the different classification abilities of Entropy AF measurement when using different parameter combinations. These differences were quantitatively evaluated by the AUC metric as follows: 98.15% for n = 0.125, 98.08% for n = 0.5, 94.11% for n = 1, 82.94% for n = 2, and 78.06% for n = 4. Figure 2 shows the results when n is set as 0.125 and r varies from 0.05 to 0.9. We can still observe that the distribution of Entropy AF values for AF and non-AF segments separates differently when using different r values. The separation between the two groups with a small value (r = 0.05) is still more visually obvious than that with a large value (r = 0.9), quantitatively confirmed by the different AUC values, as follows: 98.15% for r = 0.05 or 0.1, 97.95% for r = 0.2, 93.93% for r = 0.5, and 88.27% for r = 0.9. These two figures indicate that Entropy AF can distinguish AF from non-AF rhythms better when the parameters of n and r have small values. Table 2 gives an overview of the AUC results for classifying AF and non-AF rhythm types under different parameter combinations. The tolerance threshold r was set from 0.05 to 0.95, with a step of 0.05. In addition, two edge values of r = 0.01 and 0.99 were also tested as the optimal AUC value was found on the edge with small r and n values. The similarity weight n was set as 2 K , and K varied from −4 to 4, with a step of 1, i.e., n had the following values: 0.0625, 0.125, 0.25, 0.5, 1, 2, 4, 8, and 16. Figure 3 shows the AUC results of 3D color diagram for the space of scanned r and n. The optimal AUC value appeared on the edge, under the condition of the small tolerance threshold r and similarity weight n. The AUC value had a maximum of 98.15% (marked as bold) when the parameter combinations were set as r = 0.01 and n varied from 0.0625 to 0.5; r = 0.05 and n varied from 0.0625 to 0.25; and r = 0.10 and n varied from 0.0625 to 0.125. When the two parameters increased, the AUC values decreased, which indicates the decreased detection capability for the AF rhythm.

Inferential Analysis from the Calculation of Vector Distances
The distance between vectors was calculated using the ranged function, as shown in Equation (2). As m is set as 1, dX m i,j is always 0, and thus the vector similarity degree DX m i,j (n, r) in Equation (3) and BX m (n, r) in Equation (4) is always equal to 1. So, the value of Entropy AF only depends on the vector similarity degree when dimension m increases to m + 1, and the equation is as follows: Herein, each vector X m+1 i only includes two consecutive RR intervals. It is important to explore how the change in the two vector elements influences the entropy output.    From Equation (9), when the two vectors x i and x j are on the lines as shown in Figure 4 (at an angle of 45 degrees to x-axis, y = x + a or y = −x + a, where a is a constant), dX m+1 i,j will be 0. When the two vectors x i and x j are on the lines as shown in Figure 5 (on or parallel to the x-axis or y-axis, y = a or x = a, where a is a constant), then dX m+1 i,j will be 1. Figure 6 shows the trend of vector distance with the change of vector angle, i.e., when vector angle changes from 45 degrees to 0 degrees with the x-axis or y-axis, the vector distance changes from 0 to 1.
We randomly selected 1000 30-beat segments for the AF and N rhythms each, and further calculated the vector similarity degree DX m i,j (n, r) as defined in Equation (3). Figures 7 and 8 show the vector similarity degree (DX m+1 i,j ) histograms for AF and N rhythm segments under different parameters of n. The raw vector similarity degree distribution could be observed when n = 1, as it did not have the effect from the power of n, i.e., dX m+1 i,j n . When the power of n was employed to the vector similarity degree (DX m+1 i,j ), the distribution of the histogram changed accordingly. As shown in Figures 7 and 8, the raw vector similarity degree (DX m+1 i,j ) had a nearly uniform distribution for both the AF and N rhythms. When applying a small value of power n (n < 1), the vector similarity degree was enlarged due to the dX m+1 i,j n . So, we can observe the vector similarity degree distribution slope to the right, except for the original vector similarity degree of 0. The opposite situation can be observed when employing a large value of power (n > 1).
The entropy value was mainly determined by two factors: (1) the vector similarity degree distribution and (2) the vector similarity judgement rule. From Figures 7 and 8, we can see that a small power of n can separate the zero and non-zero vector similarity degree, and then a small threshold for r can further easily separate the vectors into similar or unsimilar classes. Thus, we obtained a good performance for the entropy measure to classify AF rhythms. Therefore, we obtained a better classification effect when using a parameter combination of n and r with small values.   Figure 9 shows the cumulative distribution function (CDF) for vector similarity degrees for the AF and N rhythm segments when using different parameters of n. We can observe that the small parameter of n gave more selections for threshold r to distinguish the two rhythm types (AF and N). When using n = 0.125, the two rhythm types remained in separated curves from each other within a large range of similarity degrees, i.e., a range of 0 < r < 0.6 could be used to classify the two groups with a high possibility. This inference was confirmed by the quantitative analysis of the AUC metric, as shown in Table 2. When using n = 0.125, AUC retained high values of 98.15%, 97.95%, 97.07%, and 95.66% for r = 0.1, 0.2, 0.3, and 0.4, respectively. However, when adding parameter n, selections of threshold r to distinguish the two rhythm types decreased. When using n = 0.25, the AUC value decreased to 93.66% for r = 0.4. When using n = 0.5, the AUC value further decreased to 88.66% for r = 0.4. These differences in the cumulative distribution function of vector similarity degrees could cause differences in entropy values, as shown in Figures 1 and 2. In Figure 1, parameter r was set as a fixed value of 0.05, leaving the opportunity to observe the effect of parameter n on the entropy outputs. When n had s small value of 0.125, 0.25, and 0.5, as shown in Figure 9, the cumulative distribution function of the vector similarity degrees from the two types were different, thus the entropy values were significant different (see Figure 1A−C), demonstrated by the AUC values of 98.15%, 98.15%, and 98.08%, respectively ( Table 2). As parameter n increased, the value of Entropy AF for the AF and N rhythms both decreased, as shown in Figure 1, sd the increased n generated the shrinkage of dX m i,j n as shown in Equation (3) and the diminished dX m i,j n induced the decrease of entropy values. However, the entropy values in the AF rhythm changed more rapidly than those in the N rhythms. Thus, when n increased to 4, the two groups almost merged with each other entirely, resulting in a difficult distinguishment between two groups (see Figure 1E), demonstrated by an AUC value of 78.06% (Table 2).
In Figure 2, parameter n remained a fixed value of 0.125, and the parameter r increased from 0.05 to 0.9. As demonstrated in Figure 1, the parameter combination of n = 0.125 and r = 0.05 obtained a high AUC value of 98.15%. When parameter r increased, it increased the value of ln(2r), as shown in Equation (8), and thus generated an increase in Entropy AF . In contrast, the value for the non-AF rhythm changed more rapidly than that of the AF rhythms, and when r = 0.9, the two groups were merged with a large proportion, resulting in a low AUC value of 88.27%. Therefore, we concluded that when parameters n and r were both small, the entropy value distributions separated from each other very obviously, and thus Entropy AF had a better capability for AF detection.

Discussion and Conclusions
This study aimed to analyze the influence of different parameters' values on Entropy AF for AF identification, and to determine the effective combination for parameters r and n in order to obtain a good recognition effect.
The determination of entropy parameters plays an important role in the entropy calculation and the physiological signal analysis [25]. Generally, the recommended parameters are as follows: embedding dimension m = 1 or 2 according to the length of RR segments, threshold r is between 0.1 and 0.25 times the standard deviation (SD) of the time series [26,27], and data length of N (varied in different situations) [28][29][30][31]. In this study, N was set as 30 and m was set as 1, because of the small value of N, i.e., as m and N were suggested to meet the requirement of N ≈ 10 m ∼ 10 m+1 from the previous studies [25][26][27][28]. We focused on the other two parameters, tolerance threshold r and similarity weight n, where n is the similarity weight in the fuzzy-entropy-based calculation [24,32].
It is worth noting that we used m = 1 in the current study due to the short RR segments (30 RR interval length). From the calculation process of entropy, as shown in Equations (1)-(8), m = 1 induced the reconstructed vector X m i and only included one element. So, the distances between two vectors, X m i and X m j , could not be quantified in Equation (2) and were defined as 0, and the similarity degree DX m i,j (n, r) was always equal to 1. Thus, the value of Entropy AF was dependent on the vector distances when the embedding dimension increased to m + 1 = 2, i.e., from the comparison between two vectors, X m+1 i and X m+1 j . Figures 7 and 8 show the variation trends of the vector similarity degree changed from 0 to 1. When the vector similarity degrees changed to the power of n, the similarity degree distribution for both AF and N rhythms also changed. When parameter n was small (n = 0.125, 0.25, and 0.5), and the smaller n was, the large similarity degrees were more concentrated and separated more obviously with a distance of 0. The variation of the similarity degrees led to a change of Entropy AF values for both the AF and N rhythms. When r remained a relatively small value (r = 0.05), the distribution of entropy value for the AF and N segments separated the most obviously when n = 0.125, and when parameter n became larger, the two distribution gradually merged with each other. The variation trend was similar to the cumulative distribution function of vector similarity degrees: the two curves for the AF and N segments separated with each other when n was small (n = 0.125), and as n increased, the length of separation from similarity degree 0 for the two curves became shorter. Except for the affection brought from parameter n, parameter r also had an impact on Entropy AF values. When n was set to a constant value (n = 0.5), the distribution of entropy values for AF and N segments also changed as r increased-from obviously separated (r = 0.05) to almost merged with each other (r = 0.6).
Another interesting issue is whether the RR interval segments should have been resampled as the cardiac cycle was inherently irregularly spaced in time, and thus generated an unevenly sampled RR interval time series. Usually, spectral estimates of the heart rate variability (HRV) often use an evenly sampled time series to perform the calculation of the frequency analysis method, such as fast Fourier transform (FFT) and wavelet analysis [33]. Clifford and Tarassenko proved that resampling generated an over-estimation of the power spectral density (PSD) and thus decreased the accuracy of the PSD estimation [34]. Kantelhardt et al. also suggested the use of an unevenly sampled RR interval time series, as resampling and the following interpolation could induce artifacts [35]. Thus, although the potential bias exists, the frequency-based method has a need for even sampling in order to perform the implementation of FFT and wavelet analysis. However, in the current study, we did not involve the frequency analysis for RR interval segments, and only focused on the distance calculation between different RR intervals. So, we kept the unevenly sampled RR intervals to avoid the potential bias due to resampling.
The results show that small r and n values can make the separation of Entropy AF values for the distribution of AF and non-AF segments more obvious, and can improve the detection capability of Entropy AF for the AF rhythm. The best combinations of the two parameters to identify the AF rhythms were as follows: r = 0.01, n = 0.0625, 0.125, 0.25, or 0.5; r = 0.05 and n = 0.0625, 0.125, or 0.25; and r = 0.10 and n = 0.0625 or 0.125.