{'fraction_non_alphanumeric': 0.03418009087154068, 'fraction_numerical': 0.01755472945064023, 'mean_word_length': 4.673696543643819, 'pattern_counts': {'":': 0, '<': 0, '<?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}}
Estimation of f-wave Dominant Frequency Using a Voting Scheme

Introduction: Atrial fibrillation (AF) is the most common heart arrhythmia, characterized by the presence of fibrillatory waves (f-waves) in the ECG. We introduce a voting scheme to estimate the dominant atrial frequency (DAF) of f-waves. Methods: We analysed a subset of Holter recordings obtained from the University of Virginia AF Database. 100 Holter recordings with manually annotated AF events, resulting in a total 363 AF events lasting more than 1 min. The f-waves were extracted using four different template subtraction (TS) algorithms and the DAF was estimated from the first 1-min window of each AF event. A random forest classifier was used. We hypothesized that better extraction of the f-wave meant better AF/non-AF classification using the DAF as the single input feature of the RF model. Results: Performance on the test set, expressed in terms of AF/non-AF classification, was the best when the DAF was computed computed the three best-performing extraction methods. Using these three algorithms in a voting scheme, the classifier obtained AUC=0.60 and the DAFs were mostly spread around 6 Hz, 5.66 (4.83-7.47). Conclusions: This study has two novel contributions: (1) a method for assessing the performance of f-wave extraction algorithms, and (2) a voting scheme for improved DAF estimation.


Introduction
Atrial fibrillation (AF) is the most common arrhythmia with a prevalence that increases with age [1]. AF diagnosis using the surface ECG is mainly based on whether the RR interval pattern is irregular, P-wave are absent, and fibrillatory waves (f-waves) present, where RR interval irregularity stands out as the most prominent. However, other arrhythmias are also manifested by irregular RR interval patterns which resemble AF. Therefore, f-wave information is important to consider when distinguishing AF from other arrhythmias. However, f-wave extraction is complex since the atrial and ventricular activities overlap in both the spectral and the temporal domain. Several methods have been proposed to address this problem. When the number of leads is limited such as in Holter systems, average beat subtraction, also known as template subtraction (TS), is a widely used technique [2]. A disadvantage with this approach is its inability to handle non-stationary situations, leading to that the extracted f-wave signal is distorted and contains QRST residuals.
The performance of f-wave extraction algorithms has been benchmarked by means of simulated ECG signals using local performance measures, including the root mean square error between the ground truth and the extracted f-wave signal [3]. Other types of local performance measures quantify the amount of QRST-related residuals and the spectral concentration [4]. Another approach to assessing performance is to employ global measures, pursued in the present study together with the hypothesis that better f-wave extraction means better AF/non-AF classification. Classification is performed using the dominant atrial frequency (DAF) as the single input feature.

Dataset
The University of Virginia Atrial Fibrillation Database (UVAFDB) [5,6] consists of 3-lead ECG Holter recordings acquired during the period 2004-2010 by the University of Virginia health system. Recordings were digitized at 200 Hz. The database contains 2,891 recording of patients, with rhythm annotation automatically generated by the Philips Holter software. In the present study, we use a subset of 100 recordings from patients older than 18 years, each recording manually reviewed and annotated with respect to AF events by an expert cardiologist as described in [7]. The median and interquartile patient age were 69.0 (58.8-76.2), each was 24h long. A total of 457 non-overlapping AF events lasting 128.0 (68-718) seconds was analyzed.

Preprocessing
Similar to the work in [8], we computed the signal quality index bSQI [9][10][11] and discarded segments when below 0.8. ECG recordings were prefiltered using a zerophase second-order infinite impulse response bandpass filter, with a passband of 0.67-100 Hz to remove baseline wander and high-frequency noise [12]. A notch filter at 60 Hz was used to remove power-line interference. Channel 1, approximating a modified lead V1 was used as it is the most informative lead for expert annotation.

F-wave extraction
In this work, we evaluate four TS techniques for singlelead f-wave extraction. The algorithms were originally implemented in the context of fetal ECG extraction from the abdominal fetal-maternal mixture [13]. These algorithms are similar to those used in the context of f-wave extraction as they aim to cancel out the pseudo-periodic components in phase with the (maternal) cardiac cycle, while leaving the fetal ECG (in case of fetal ECG) or the f-waves (in case of AF) in the residual signal.
The first algorithm is the basic TS adapted from [14] denoted as T B : A QRST template is obtained by averaging temporal QRST windows with respect to the duration of the whole cardiac cycle. The QRST template is then subtracted from the original ECG signal, resulting in a residual signal that contains the f-wave and residual noise. The other three TS variants offer different degrees of adaptability of the template: in TS CE the QRST template is scaled by a gain before subtraction [15]; in TS SU the scaling procedure is performed for the P-wave, the QRS-complex and the T-wave individually [16]; in TS P CA (principal component analysis, PCA) the almost periodic characteristics of the ECG is used for selective separation of the QRST and the f-waves [17].
The algorithms are listed in Table 2.4. Following the preprocessing step, AF events were extracted, then f-wave extraction algorithms were run only on the first minute of each event. We used 1-min windows similar to the work in [18]. Matlab R2021a and Python 3.8 were used. An example of the extracted f-wave is shown in Fig 1.

Machine learning
A random forest (RF) classifier was used. We extracted similar number of non-AF and AF windows for which the DAF was computed. A train-test split of 80%-20% was performed with equal number of AF/non-AF windows in the training set. To asses the performance of the trained RF in classifying AF and non-AF windows correctly, the following statistics were computed: the harmonic mean between the sensitivity and positive predictive value, denoted F 1 , and the area under the receiver operating characteristic (AUROC). The default decision threshold was used for classification in training and testing.

Frequency estimation
Spectral analysis of the extracted f-wave signals was applied to estimate the DAF, defined as the position of the largest peak in the interval of 4-12 Hz of the power spectrum of the extracted f-wave signal [2]. The power spectrum was computed using Welch's method with a Hamming window and 50% segment overlap. An example of power spectrum is shown in Fig. 2. After extracting the DAF using the different algorithms, a voting scheme was applied to determine the final DAF, i.e., the median value was taken as the DAF across the best performing methods for AF classification. Since real data were analyzed, a comparison of the resulting DAF to that of a reference f-wave signal could not be done.

Results
No recordings were excluded from the dataset due to low quality. 476 AF event were extracted with length of 30 seconds defined to be the minimal length of AF episode as in [8]. Out of those, 94 (20.57%) events shorter then 1min were excluded, as windows of 1-min length were used. Results are shown for total of 363 AF windows belonging to 72 recordings.
The test set classification performances for the DAF estimation using TS B , TS SU or TS CE were AUROC of 0.59, 0.59 and 0.59, respectively ( Table 2). The voting scheme involving the three best performing techniques obtained an F 1 of 0.63 and an AUROC equal to 0.60. Using the voting scheme, the DAF was mostly spread around median,

Discussion
The main contribution of this research is the introduction of a novel method for assessing f-wave extraction performance, whereas, in previous research, the emphasis has been on assessing local performance of f-wave extraction. An interesting approach was to use simulated ECG sig- nals as it provides access to the ground truth, however, simulation has the disadvantage of not fully account for the physiological variability across patients. As a consequence, we seek to develop a new method for assessing the performance of f-wave extraction algorithms based on real data experiments where the ground truth DAF is unknown.
Another important contribution of this study is the introduction of a voting scheme for DAF estimation based on the three best performing algorithms, i.e., TS B , TS SU and TS CE . This work has important limitations. First, the dataset is limited to 100 patients all from a single cardiac center. Future work needs to evaluate the performance of the algorithms on datasets from multiple centers, across ethnicity, age and gender. A second limitation is that we focused on the extraction of the DAF as the sole feature for assessing the performance of f-wave extraction. The usage of this single feature may not be enough to best rank the fwave extraction algorithms using our data-driven method. Other f-wave features such as amplitude may also be taken into account to supplement the DAF in training the RF classifier. In that respect the ranking of the algorithms could change. Finally, other extraction algorithms could be included [2], e.g., noise-dependent weighted averaging, adaptive filtering and Kalman filter based methods [13].