# Comparison of Dimensionality Reduction Approaches and Logistic Regression for ECG Classification
## 3 Materials and Methods
### Dimensionality Reduction
#### 3.1.2 Uniform Manifold Approximation and Projection  
Uniform Manifold Approximation and Projection (UMAP) [10] is a nonlinear dimensionality reduction technique grounded in Riemannian geometry and algebraic topology. It begins by constructing a fuzzy topological structure that models the underlying manifold, under three key assumptions: the data are uniformly distributed on a Riemannian manifold, the Riemannian metric is locally constant, and the manifold is locally connected. UMAP then optimizes a low-dimensional projection by minimizing the cross-entropy between fuzzy topological representations, using stochastic gradient descent and negative sampling to enhance computational efficiency. UMAP is increasingly recommended in biomedical domains, including clinical data analysis, brain imaging, longitudinal proteomics, elec  
Figure 2: Illustrative ECG waveforms. (**Left**): SR with regular morphology; (**Right**): AFIB with absent P waves and irregular R-R intervals.  
tronic health records (EHRs), and electrocardiogram (ECG) datasets [11], particularly for its ability to reveal complex data structures (see Figure 3). Comparative studies have shown that UMAP outperforms traditional methods such as PCA and t-SNE in preserving both local and global structures. In particular, [PERSON] et al. [12] reported that UMAP significantly improved arrhythmia classification performance when integrated with ensemble classifiers. The main steps of the UMAP algorithm, originally introduced by [PERSON] et al. [13], are described below (Algorithm 1).  
```
0: Dataset \(\mathcal{X}=\{x_{1},x_{2},\ldots,x_{n}\}\subset\mathbb{R}^{D}\), number of neighbors \(k\), target dimension \(d\)
0: Low-dimensional embedding \(\mathcal{Y}=\{y_{1},y_{2},\ldots,y_{n}\}\subset\mathbb{R}^{d}\)
1: Compute the \(k\)-nearest neighbors for each point \(x_{i}\) in \(\mathcal{X}\) using a suitable distance metric
2: For each \(x_{i}\), compute a local connectivity function: \[\mu_{i}=\min_{j\in\text{kNN}(i)}\{d(x_{i},x_{j})\}\] \(\rho_{i}=\text{smallest distance such that at least one neighbor is at distance > 0
3: Define the edge weight between points \(x_{i}\) and \(x_{j}\) as: \[w_{ij}=\exp\biggl{(}-\frac{d(x_{i},x_{j})-\rho_{i}}{\sigma_{i}}\biggr{)}\] where \(\sigma_{i}\) is chosen such that: \[\sum_{j\in\text{kNN}(i)}\exp\biggl{(}-\frac{d(x_{i},x_{j})-\rho_{i}}{\sigma_{ i}}\biggr{)}=\log_{2}(k)\]
4: Construct a fuzzy topological representation (weighted graph) \(G_{H}\) in high dimensions with edge weights \(w_{ij}\)
5: Initialize a low-dimensional embedding \(\mathcal{Y}\subset\mathbb{R}^{d}\) (e.g., using spectral initialization or randomly)
6: Optimize \(\mathcal{Y}\) by minimizing the cross-entropy between high-dimensional and low-dimensional graphs: \[C=\sum_{(i,j)}w_{ij}\log\biggl{(}\frac{w_{ij}}{w^{\prime}_{ij}}\biggr{)}+(1- w_{ij})\log\biggl{(}\frac{1-w_{ij}}{1-w^{\prime}_{ij}}\biggr{)}\] where \(w^{\prime}_{ij}\) are edge probabilities in low dimensions (e.g., using: \[w^{\prime}_{ij}=\frac{1}{1+a\|y_{i}-y_{j}\|^{2b}}\] with suitable parameters \(a\), \(b\))
7: Use stochastic gradient descent (SGD) to minimize \(C\)
8:return Low-dimensional embedding \(\mathcal{Y}\)
```  
**Algorithm 1** UMAP Algorithm  
For the validation step, both dimensionality reduction algorithms (PCA and UMAP) are combined with the \(k\)-Nearest Neighbor (KNN) algorithm as the supervised classification approach [14] for diagnostic decision. The classification of a new ECG record will be carried out by the most recurrent class of its \(k\)-Nearest Neighbors. The optimal number of neighbors, \(k\), is a hyperparameter that has been estimated by cross-validation [15]. We used 3 dimensions for comparability and visualization purposes, and applied the standard parameters recommended in [10; 11].