# Detection of Electromagnetic Seismic Precursors from Swarm Data by Enhanced Martingale Analytics
## 2 Electromagnetic Anomaly Detection via Martingale Systems  
Martingale probability theory models a fair system where, in gambling terms, only one successful bet is needed to recover from previous losses. A sequence of random variables \(V_{i}\), where \(i\) ranges from some starting point to infinity, is considered a Martingale with respect to another sequence of random variables \(Z_{i}\) if certain conditions are met. Specifically, for all \(i\geq 0\), \(V_{i}\) must be a measurable function of \(Z_{0}\),..., \(Z_{i}\), the expected absolute value of \(V_{i}\) must be finite, and the conditional expectation of \(V_{n+1}\) given \(Z_{1},\ldots,Z_{n}\) is equal to \(V_{n}\), indicating that \(V\) is expressible in terms of \(z\) with finite expectation. In simpler terms, a Martingale is a sequence where each new value is, on average, equal to the previous value. In our problem domain, we are interested in exchangeability testing using Martingale theory [8; 16]. Exchangeability refers to a property of the joint distribution of \(Z_{i}\), where for any subset of \(Z_{i}\) the joint distribution remains the same under permutation. In other words, the order of the sequence does not affect the probability distribution. To assess exchangeability, we utilize a strangeness measure, as described in [9], which evaluates how unusual a data point is compared to others in its set. Since anomaly detection is typically unsupervised, we employ a cluster-based strangeness measure incorporating distance metrics. Seismic events, such as earthquakes, are often preceded by various precursor phenomena, including changes in electromagnetic fields. These electromagnetic anomalies arise due to the complex interactions between tectonic plates, stress accumulation, and the release of energy along fault lines. As seismic activity generates stress within the Earth's crust, it can lead to the fracturing of rocks, which in turn produces electrical charges and perturbations in the surrounding electromagnetic field. Detecting electromagnetic anomalies as precursors to seismic events offers valuable insights into the underlying processes leading to earthquakes. However, it is crucial to address several key questions regarding this approach. Firstly, can electromagnetic anomalies reliably serve as indicators of impending seismic activity? Research suggests that while electromagnetic precursors show promise, their predictive value may vary depending on factors such as the proximity to the epicenter and the magnitude of the impending earthquake. Furthermore, the use of satellite-based electromagnetic monitoring systems raises questions about detection distances and false positives. Satellites equipped with electromagnetic sensors can capture data over large geographic areas, allowing for wide-scale monitoring. However, it is essential to ensure that detected anomalies are genuinely related to seismic activity and not incidental variations in the electromagnetic field. To address these concerns, our approach incorporates rigorous statistical methods, such as Martingale theory, to analyze electromagnetic data and identify anomalies indicative of seismic precursors. By employing cluster-based strangeness measures and considering spatial and temporal relationships, we aim to distinguish genuine anomalies from background noise and incidental fluctuations. This rigorous approach enhances the reliability of our anomaly detection system and contributes to the understanding of electromagnetic precursors to seismic events. For an unlabeled training set \(T=x_{1},\ldots,x_{n}\), such as the EMF data from Swarm satellites, the strangeness of \(x_{i}\) is defined as \(s(T,x_{i})=||x_{i}-c||\), where \(c\) is the centroid of \(T\) and \(||\cdot||\) denotes a distance metric. This strangeness measure represents the distance of a data point from the centroid of its cluster, serving as a measure of its abnormality.