# A Heart Rate Variability-Based Paroxysmal Atrial Fibrillation Prediction System
## 2 Materials and Methods
### Feature Matrices Conversion  
The purpose of this task is to convert each HRV sequence from its original data space into a feature space such that characteristics differentiating PAF from non-PAF data can be more explicitly revealed than in the original space. Let the dataset be made up of a set of \(m\)\(n\)-point HRV sequences, which can be denoted by X = [**x**1, **x**2,..., **x**m], where \(\textbf{x}_{i}\) = [\(x_{i,1}\), \(x_{i,2}\),..., \(x_{i,m}\)]\(T\) in the unit of beats/min, \(i\) = 1, 2,..., \(m\). The process of constructing a feature matrix \(\mathbf{A}\in\mathcal{R}^{s\times t}\) from an HRV sequence \(\textbf{x}\ \in\ \mathbb{R}^{n}\) can be accomplished through a mapping function, \(\Phi\), such that \(\mathbf{A}\) = \(\Phi\)(x). In this work, we chose the discretized Poincare plot to perform such a conversion for its easy construction, modification, and interpretation. In addition, it has been related to HRV physiology [38; 39] and adopted for HRV analysis on PAF prediction for decades [11; 13; 40; 41; 42]. However, most of the previous works used features that measure only a certain facet of the plot and thus the information carried in the plot is not fully utilized. In fact, according to the definition of various abnormal beats in [43], these beats can be found in different regions in the Poincare plot of an HRV sequence, as illustrated in Figure 1. More importantly, the discretized Poincare plot of a sequence is shift-invariant in that the plot is independent of the feature locations in the sequence. A Poincare plot is a graph of \(x_{i}\) versus \(x_{i+1}\) of a sequence, \(\textbf{x}\) = \(x_{1}\), \(x_{2}\),..., \(x_{n}\), where \(I\) = 1, 2,..., \(n-1\). This plot is used to capture the correlation between two consecutive data points. It can be extended to calculate the correlation between sequential data points that are \(\tau\) points away (lag), where \(\tau\) is a positive integer less than \(n\). Therefore, an \(n\)-point sequence can be represented by an extended Poincare plot by drawing the points (\(x_{i}\), \(x_{i+\tau}\)) where \(i\) = 1, 2,..., \(n-\tau\). However, the Poincare plot is a 2-dimensional real-valued image with an infinite number of points in a data-dependent range of [\(l_{x}\), \(u_{x}\)] \(\times\) [\(l_{x}\), \(u_{x}\)], where \(l_{x}\) = min(**x**) and \(u_{x}\) = max(**x**). To generate a fixed-size matrix \(\mathbf{A}\in\mathbb{R}^{\mathbb{N}^{\times s\times s}}\) for each HRV sequence, the range of allowable heart rates is to be defined, and then the resultant plot needs to be discretized before it can be used in the subsequent analysis. Let \(l_{p}\) and \(u_{p}\) represent accordingly the lower and the upper bounds of the heart rates to be included \begin{table}
\begin{tabular}{c c c} \hline \hline
**Dataset** & **Non-PAF Sequences (Persons)** & **PAF Sequences (Persons)** \\ \hline Training & 444 (37) & 516 (46) \\ Validation & 120 (10) & 120 (10) \\ Testing & 3850 (18) & 1035 (21) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The number of non-PAF and PAF 400-point HRV sequences and the number of corresponding persons in our training, validation, and testing datasets. Figure 1: Regions related to different abnormal beats in an accumulated discretized Poincaré plot of PAF HRV sequences. in the feature matrix \(A\). The \((i,j)\)-th component of the feature matrix, \(A(i,j)\), \(1\leq i,j\leq s\), denotes the number of points lying within the region in the Poincare plot defined by \([l_{p}+(i-1)q,l_{p}+iq]\times[l_{p}+(j-1)q,l_{p}+jq]\), where \(q=(u_{p}-l_{p})/s\) is the quantization factor. The quantitation factor affects not only the heart rate range considered in our system, but also the level of noise tolerated by the system. In this design, the lower and the upper bounds of the Poincare plot can be adjusted to reduce noise in an HRV sequence introduced by incorrect QRS detection.