# An Anomaly Detection Ensemble for Protection Systems in Distribution Networks
## 2 Data Dimension Reduction Model Based on KPCI
The mapping function is shown as follows:  
\[\Psi\to S \tag{4}\]  
In the formula, \(\Psi\) is a nonlinear function. The only constraint on the feature space \(S\) is that it must have the structure of a reproducing kernel Hilbert space. KPCI can be used to solve the following eigenvalue problem. The goal is to find the eigenvector \(\alpha\) that maximizes the ratio of the variability in that direction to the total variability:  
\[X\cdot\alpha=\lambda\cdot\alpha,\parallel\alpha\parallel_{2}=\frac{1}{\lambda} \tag{5}\]  
In the formula, \(\lambda\) is the eigenvalue of the matrix \(X\). \(\alpha\) is a column vector with a dimension of \(k\), and \(X\) is the kernel matrix, constructed as follows:  
\[X= \begin{bmatrix}x\left(a^{1},a^{1}\right)&\cdots&x\left(a^{1},a^{k}\right)\\ x\left(a^{2},a^{1}\right)&\cdots&x\left(a^{2},a^{k}\right)\\ \vdots&\ddots&\vdots\\ x\left(a^{k},a^{1}\right)&\cdots&x\left(a^{k},a^{k}\right)\end{bmatrix}  \tag{6}\]  
Figure 2: Illustration of a kernel function. In the formula, \(x\big{(}a_{j},a_{i}\big{)}\) denotes the kernel evaluating the similarity between samples \(a_{j}\) and \(a_{i}\). The function \(x\) is the core of KPCI, which is a positive semi-definite function in the input space used to deal with nonlinear problems. This function is often referred to as a kernel. The most commonly used kernel functions include polynomial, Gaussian, etc., and are expressed as follows:  
\[x\big{(}a_{j},a_{i}\big{)}=\Big{(}a_{j}^{T}a_{i}+c\Big{)}^{d} \tag{7}\]  
\[x\big{(}a_{j},a_{i}\big{)}=exp\left(-\frac{\parallel a_{j}-a_{i}\parallel^{2} }{2\gamma^{2}}\right) \tag{8}\]  
In Equation (7), \(c\in R^{+}\) and \(d\in K^{+}\); in Equation (8), \(\gamma\in R^{+}\). Kernel principal component investigation (KPCI) performs a linear principal component investigation (PCI) in the implicit feature space that is induced by the kernel, which can help tie all the data together. In this context, the \"kernel\" refers to the kernel function, a mathematical technique used to transform input data into a higher-dimensional space. The advantage of KPCI is that it can capture nonlinear relationships in the data, making it more powerful than standard PCI for certain types of data. Based on the characteristic that the data do not easily diverge during transmission, this paper selects Sigmoid, and its mathematical expression is as follows:  
\[x\big{(}a_{j},a_{i}\big{)}=arctan\Big{(}ma_{j}^{T}a_{i}+c\Big{)} \tag{9}\]  
In the formula, \(c\) is a constant that can control the length of the lower order term, and in this paper, it is set to 1. \(a_{j}\) and \(a_{i}\) are sample vectors. Based on the principle of PCI, the eigenvector corresponding to the maximum eigenvalue is the direction in which KPCI needs to be projected, and the calculation method is as follows:  
\[\Psi^{l}=\sum_{j=1}^{k}u_{j}^{l}a\Big{(}a^{j},a^{i}\Big{)} \tag{10}\]  
In the formula, \(\Psi^{l}\) is the first principal component and \(u_{j}\) are the eigenvectors. If \(X\) has not been centered yet, the following formula is used to implement centering. Centralization refers to the process of subtracting the mean from each variable so that the mean value of each feature becomes zero. Standardization is the process of dividing each feature value by its standard deviation. This process ensures that all features have the same importance in the analysis, and avoids the biases caused by different units of measurement:  
\[X_{c}=X-X1_{K}-1_{K}X+1_{K}X1_{K} \tag{11}\]  
In the formula, \(X_{c}\) is the matrix after data \(X\) centering, and \(1_{K}\) is the \(K\times K\) matrix.