# Anomaly Detection in High-Dimensional Time Series Data with Scaled Bregman Divergence
## 2 Materials and Methods
### Scaled Bregman Divergence-Based Dissimilarity Measure  
Previous studies have employed divergence measures such as Kullback-Leibler (KL) divergence and Pearson (PE) divergence to quantify the dissimilarity between two distributions, \(p_{tr}(x)\) and \(p_{te}(x)\). For instance, the Kullback-Leibler Importance Estimation Procedure (KLIEP) [29] was developed for anomaly detection and change-point detection using KL divergence. Similarly, Pearson divergence has been used in the unconstrained least-squares importance fitting (uLSIF) method [31], which has been applied to detect anomalies [37] and change points [40]. Pearson divergence is defined as  
\[PE(p_{tr}||p_{te})=\frac{1}{2}\int p_{te}(x)\bigg{(}\frac{p_{tr}(x)}{p_{te}(x)} -1\bigg{)}^{2}dx. \tag{1}\]  
[PERSON] et al. 's work [37] demonstrated that uLSIF outperforms other algorithms for anomaly detection due to its unique global optimal solution. However, it has been observed in prior change-point detection studies that the density ratio used in uLSIF can become unbounded under certain conditions, potentially affecting the method's stability. The unboundedness problem commonly encountered when using KL and Pearson divergences as dissimilarity measures poses significant challenges in many anomaly detection and change-point detection applications [40]. To mitigate this issue, a RuLSIF (relative unconstrained least-squares importance fitting) method, which utilizes the \(\alpha\)-PE divergence, was developed for change-point detection [40], but has never been applied for anomaly detection. Furthermore, our recent work [35] proposed a scaled Bregman divergence for change-point detection, which has shown superior performance in addressing these challenges. In this study, we extend and adapt this scaled Bregman divergence-based method for anomaly detection. Given three measures \(P\), \(Q\) and \(M\) on \(\mathcal{X}\) with densities \(p\), \(q\) and \(m\), respectively, a scaled Bregman divergence [41] is defined as  
\[D(p\|q;m)=\int_{\mathcal{X}}\bigg{[}f\bigg{(}\frac{p(x)}{m(x)}\bigg{)}-f\bigg{(} \frac{q(x)}{m(x)}\bigg{)}-f^{\prime}\bigg{(}\frac{q(x)}{m(x)}\bigg{)}\bigg{(} \frac{p(x)}{m(x)}-\frac{q(x)}{m(x)}\bigg{)}\bigg{]}m(x)dx, \tag{2}\]  
where \(f:\mathbb{R}^{+}\rightarrow\mathbb{R}\) is a convex function, and \(f^{\prime}\) is its right derivative. Different choices of the measure \(M\) and function \(f\) yield various well-known divergence functions. For instance, let \(f(t)=\frac{1}{n}(t-1)^{n}\); when \(n=2\), a novel divergence, termed the Pearson-like scaled Bregman divergence (PLsBD), was derived in our recent work [35], which is expressed as  
\[PL(p_{tr}\|p_{te};m)=\frac{1}{2}\int_{\mathcal{X}}m(x)\bigg{(}\frac{p_{tr}(x)} {m(x)}-\frac{p_{te}(x)}{m(x)}\bigg{)}^{2}dx. \tag{3}\]  
Our work [35] has theoretically proven several properties of PLsBD compared to other divergences. For example, PLsBD is bounded, can be symmetric, and can serve as a metric measure under certain conditions. Consequently, in our change-point detection application, PLsBD has demonstrated superior performance compared to all density ratio estimation-based methods. It is easy to verify that if the measure density \(m(x)=p_{te}(x)\), the proposed PLsBD reduces to the Pearson divergence. To address the unboundedness issue in the divergence measure, we typically introduce a measure density \(m_{\alpha}(x)=\alpha p_{tr}(x)+(1-\alpha)p_{te}(x)\), where the parameter \(\alpha\in(0,1)\) controls the mixing of the training and testing distributions. This balancing of contributions from both distributions ensures stability in the divergence calculation and effectively mitigates unboundedness issues.