# Detection of Electromagnetic Seismic Precursors from Swarm Data by Enhanced Martingale Analytics
## 3 Experiments
### Quantitative Experiment  
To analyze the developed approach, we devised two experiments. The first experiment is geared towards obtaining quantitative metrics such as accuracy, precision, and \(r\)-rank for both the original Martingale framework [9] and the novel approach presented in this work. Standard statistical measures are employed to compute the evaluation metrics of accuracy and precision. Specifically, we define the real positives (\(P\)) and real negatives (\(N\)) of the data, creating two groups. Following standard practice, data are split into true positives (TP), true negatives (TN), false positives (FP), and false negatives (FN); these definitions form the basis of precision and accuracy calculations. Precision reflects the number of correct identifications within the positive (TP and FP) categories and is defined as  
\[\text{Precision}=\frac{\text{TP}}{\text{TP}+\text{FP}} \tag{8}\]  
Accuracy reflects the correctness of the overall results, including both positive and negative outcomes, and is defined as  
\[\text{Accuracy}=\frac{\text{TP}+\text{TN}}{\text{TP}+\text{FP}+\text{TN}+ \text{FN}} \tag{9}\]  
Accuracy measures the overall correctness of the results, considering both positive and negative outcomes. It quantifies the proportion of correctly classified instances among all instances, encompassing true positives (correctly identified anomalies) and true negatives (correctly identified non-anomalies), over the total number of instances. Precision, on the other hand, focuses specifically on the accuracy of the positive results. It quantifies the proportion of correctly identified anomalies (true positives) among all instances classified as anomalies, including both true positives and false positives (instances wrongly identified as anomalies). The \(r\)-rank, also known as the R-metric, is a metric [18] gaining popularity in contexts similar to the problem areas addressed in this paper. It involves assessing the accuracy of individual methods using a predefined length. The \(r\)-rank takes into account the localization of anomalies by ranking them and serves as a measure of accuracy by comparing expected anomalies with detected anomalies in terms of importance, typically using a ranked nearest neighbor approach. Essentially, it evaluates how accurately the detected anomalies are ranked compared to the true known anomalies, reflecting the method's performance. Our first experiment is aimed at assessing the efficacy of our algorithm in detecting anomalies following a common experimental design in this scenario space [19]. We utilized a prominent electrocardiogram (ECG) database known as the \"BIDMC Congestive Heart Failure Database\" (CHFDB) [20; 21; 22; 23; 24], which is widely recognized for its well-documented anomalies (via a trained autoencoder) and annotated time and position data. This database comprises 15 recordings obtained from a diverse cohort of participants, including 11 men and 4 women, who suffer from severe congestive heart failure. Each recording spans approximately 20 h, with a sampling rate of 250 Hz and a 12-bit resolution. From the CHFDB, we utilize four datasets with known and understood anomalies [19]. Figure 2 shows a sample trace of the ECG used in this experiment. The CHFDB is a highly regarded resource in cardiology research, providing a comprehensive collection of ECG recordings from patients with congestive heart failure. These recordings offer valuable insights into the electrical activity of the heart during various stages of cardiac dysfunction, facilitating the development and validation of algorithms for detecting abnormal cardiac rhythms and anomalies. The database includes detailed annotations and metadata, enabling precise analysis and interpretation of the recorded ECG signals. Extensive prior studies have demonstrated that ECG data share several similarities with EMF data [25; 26]. Additionally we include another EMF dataset, \"Data4\", which was collaboratively obtained [2].