# Early Ventricular Fibrillation Prediction Based on Topological Data Analysis of ECG Signal
## 2 Materials and Methods
### TDA Features Extraction  
#### 2.2.1 Phase Space Reconstruction  
[PERSON] study, presented in the 1980s, is an important theoretical basis for PSR [24], revealing the dynamical mechanism of nonlinear systems. As stated in [PERSON] theorem, a phase space can be reconstructed from a one-dimensional chaotic time series, which is equivalent to the original system in a topological structure. Therefore, PSR is able to capture the effective information about the system from a univariate time series. **[PERSON] theorem**\(M\) is a \(d\)-dimensional manifold, the map \(\varphi:M\to M\) is a smooth differential homogeneous embryo, and the map \(y:M\to R\) has continuous second-order derivatives \(\Phi(\varphi,y):M\to R^{2d+1}\), which are described as Formula (1). \[\Phi(\varphi,y)=\Big{(}y(x),y(\varphi(x)),y\Big{(}\varphi^{2d}(x)\Big{)}, \ldots,y\Big{(}\varphi^{2d}(x)\Big{)}\Big{)}, \tag{1}\]  
Then, \(\Phi(\varphi,y)\) results in the [PERSON] of \(M\) into \(R^{2d+1}\). The current PSR commonly uses the coordinate delay reconstruction method proposed by [PERSON] et al. [25], which essentially uses a fixed time delay \(0,\tau,2\tau,\ldots,(m-1)\tau\) in a one-dimensional time series \(\{x(t)\}\) to construct the \(m\)-dimensional phase space vector:  
\[X(t)=\{x(t),x(t+\tau),x(t+2\tau),\ldots x(t+(m-1)\tau)\}. \tag{2}\]  
The phase space trajectory of the signal can be plotted as follows: plot \(x(t)\) on the \(x\)-axis and \(x(t+\tau)\) on the \(y\)-axis. Such a trajectory is called a two-dimensional phase space image. To generate a higher dimensional phase space trajectory, the embedding dimension \(m\) requires to be raised and more delay sequences need to be inserted [17]. Figure 2: Results of pre-processing. (**a**) The original ECG signal; (**b**) The pre-processed ECG signal. By comparison, the baseline drift in the original ECG signal is eliminated by moving average filtering and its amplitude is adjusted to the 0–1 range by normalization. Therefore, two important reconstruction parameters need to be determined: time delay \(\tau\) and embedding dimension \(m\). \(\tau\) and \(m\) can take arbitrary values for ideal one-dimensional time series, which are infinitely long and noiseless. However, the time series in practice are finite and noisy, so \(\tau\) and \(m\) cannot be taken arbitrarily, which may affect the effect of PSR. The criterion for choosing \(\tau\) is to make the original sequence and the delayed sequence linearly independent from each other, so that they can be treated as independent coordinates in the reconstructed phase space. Primary choosing methods include auto-correlation function (ACF) [26], average mutual information (AMI) [27], and average displacement (AD) [28]. In this study, the AMI method is applied to determine \(\tau\). The mutual information (MI) describes the correlation between two variables, which can be calculated by correlation entropy. When the MI function reaches the minimum, the corresponding \(\tau\) is the appropriate time delay. For the embedding dimension \(m\), it can be derived from [PERSON] theorem that the ideal reconstruction can be achieved when \(m\) is large enough, but the computational effort increases exponentially with the increase of \(m\). Therefore, it is necessary to find the minimum embedding dimension \(m\) that is sufficient for embedding. The common methods are singular value decomposition (SVD) [29] and false nearest neighbors (FNN) [30]. In this study, the FNN method is applied to determine \(m\). When two points that are not adjacent in the \(d\)-dimensional space become adjacent in the \((d\)-1)-dimensional space, they are called false neighbors. As \(m\) increases, the embedding becomes progressively sufficient, and the false neighbors are eliminated. When the false neighbors no longer decrease with the increase of \(m\), the trajectory is considered to be sufficiently embedded, and the optimal \(m\) is obtained. Assuming that two points in one-dimensional time series are neighbors, the distance between them is calculated.