# Early Ventricular Fibrillation Prediction Based on Topological Data Analysis of ECG Signal
## 2 Materials and Methods
### Data Pre-Processing  
Three public databases from PhysioNet are utilized in this study, including Creighton University Ventricular Tachyarrhythmia Database (CUDB), Sudden Cardiac Death Holter Database (SDDB), and Physikalisch-Technische Bundesanstalt Diagnostic ECG Database (PTBDB). CUDB consists of 35 eight-minute ECG records at a sampling rate of 250 Hz, from individuals presenting sustained ventricular tachycardia, ventricular flutter, and VF [21]. The records in SDDB were obtained primarily at Boston-area hospitals in the 1980s, and currently include 18 subjects with basal sinus rhythm (four with intermittent pacing, one with persistent rhythm, and four with atrial fibrillation), with records digitized at 250 Hz. All subjects sustained ventricular tachyarrhythmias and most suffered actual cardiac arrest [22]. The ECG records collected in PTBDB are obtained using a non-commercial PTB prototype logger and contain 549 records from 290 subjects at a sampling rate of 1000 Hz, 52 of whom are healthy controls [23]. In CUDB, some patients have less than 5 min of recording time before the onset of VF and were eliminated to meet the requirement of forecast time. In SDDB, four data labeled as atrial fibrillation, two data without VF onset time, and two VF data with poor signal-to-noise ratio were removed. Thirty subjects were selected from CUDB and SDDB as VF data. To balance the two types of data, 30 healthy subjects were selected from PTBDB as non-VF (nVF) data. All 60 selected records are shown in Table 1.  
For pre-processing, the nVF data from PTBDB were first downsampled to 250 Hz. Then, both VF and nVF data were passed through a moving average filter with a window length of 10 samples to remove the baseline drift caused by the subject's breathing; a 50 Hz band stop filter was applied to eliminate industrial frequency interference. Finally, normalization was applied to draw the distinction among the three databases by unifying the signal amplitudes to a range between 0 and 1. Figure 2 shows the results of the pre-processing.  
After pre-processing, the ECG split frame was intercepted from each VF data, as shown in Figure 1. In this study, the forecast time was selected as 5 min, and the split frame lengths were selected as 5 s, 8 s, 10 s, and 15 s, respectively. For the control data, the same length of the split frame was intercepted from each nVF data.  
Figure 1: Workflow of the proposed method for prediction of VF.  
\begin{table}
\begin{tabular}{c c c} \hline
**Database** & **Data** & **Sampling Rate** \\ \hline CUDB & ‘cu10’; ‘cu11’;‘cu13’;‘cu24’;‘cu17’;‘cu22’;‘cu23’; & \\ ‘cu05’;’cu15’;‘cu19’;‘cu32’;‘cu33’;‘cu03’;‘cu14’;‘cu18 & 250 Hz \\ SDDB & 31;32;33;34;35;36;37;38;44;45;46;47;48;50;51 & 250 Hz \\ ‘s0552’;’s0551’.re’,’s0551’.re’,’s0543.re’;s0554.re’; & \\ ‘s0533\_re’;’s0532.re’,’s0551’.re’,’s0552’.re’,’s0556.re’;/s0506.re’; & \\ PTBDB & ‘s0504\_re’;s0503.re’,’s0502.re’,’s0500.re’,’s0499.re’;s0496.re’; & \\ ‘s0491\_re’;’s0487\_re’,’s0486\_re’,’s0481\_re’;’s0480\_re’;’s0479\_re’; & 1000 Hz \\ ‘s0478\_re’;s0474.re’,’s0473\_re’;’s0472\_re’;’s0471\_re’;’s0470\_re’; & \\ ‘s0469\_re’;’s0468\_re’ & \\ \hline \end{tabular}
\end{table}
Table 1: Sixty selected ECG records from CUDB, SDDB, and PTBDB.