## 4 Auto-Associative Shared Nearest Neighbor Kernel Regression  
AAKR calculates the distance between the query vector and the training data stored in memory, as shown in Equation (1), and assigns weights based on this distance. If the query vector is close to the training data, the calculated distance will be low. When query vectors are distributed in close proximity to the training data, the SPE calculated by AAKR may incorrectly classify fault data as normal. To address the limitations of conventional AAKR, this paper proposes a fault detection method based on auto-associative shared nearest neighbor kernel regression (AASKR), which employs an attention mechanism to assign higher weights to data similar to the query vector. The fault detection procedure of the proposed method is shown in Figure 3. The offline process follows the same steps as AAKR, starting with similarity and ending with detection index calculation. The calculated detection index is then used to establish the fault detection threshold using KDE. In the online process, the distance between the query vector and the training data is calculated. Based on these distances, the k neighbors are selected before assigning weights. If there are k neighbors that share data with each other, they can be considered similar, and the distance value is adjusted downward accordingly. To identify shared neighbors, this study employs SNN. SNN, a derivative of k-nearest neighbor (kNN), quantitatively measures the proximity of fault data to common neighbors, enabling more accurate fault detection. Even when faulty data are closely distributed near normal data, SNNs demonstrate greater robustness by selectively avoiding all neighbors. Consequently, the distance between the query vector and the training data is adjusted based on the presence of shared neighbors. In cases where no shared neighbors are identified in the SNN, the distances of all k neighbors are substantially rescaled. Therefore, by readjusting the distance in the AAKR based on the presence of shared neighbors, we can emphasize training data that are similar to the given sample and similar to the weighting mechanism used in attention methods. To identify shared neighbors using SNN, the neighbors of SNN are determined based on the distance between the query vector and the training data, as shown in Equation (7):  
\[\text{SNN}_{i}\Big{(}\textbf{x}_{\text{tr}}^{i},\textbf{x}_{\text{query}} \Big{)}=\Gamma\Big{(}\textbf{x}_{\text{tr}}^{i}\Big{)}\cap\Gamma\big{(}\textbf {x}_{\text{query}}\big{)},\;i=1,\ldots,n, \tag{7}\]  
Figure 3: Fault detection procedure using proposed method. where \(\Gamma\big{(}\mathbf{x}_{\text{trn}}^{i}\big{)}\) represents the \(i\)-th neighbor of the training data adjacent to \(\mathbf{x}_{\text{query}}\), and \(\Gamma\) indicates the neighbor's index. For instance, if \(k\) is three, and \(\Gamma\big{(}\mathbf{x}_{\text{trn}}^{i}\big{)}\) and \(\Gamma\big{(}\mathbf{x}_{\text{query}}\big{)}\), then \(\text{SNN}_{i}\big{(}\mathbf{x}_{\text{trn}}^{i},\mathbf{x}_{\text{query}} \big{)}\) is three. Figure 4 shows the process of selecting shared neighbors using SNN as described in Equation (7). Given the training and query vectors, a neighbor is selected as the final neighbor if a shared neighbor exists among the k neighbors determined by the kNN. Compared to conventional distance-based methods, using only shared neighbors through SNN not only enables fault data identification with fewer neighbors but also improves computational efficiency. As a result, when the query vector is similar to the training data, a larger number of shared neighbors are selected for fault detection. Figure 5 compares the neighbor selection results of kNN and SNN based on the distance of the fault data from the normal data, illustrating how shared neighbors are selected in SNN. Black-marked circles, red-marked circles, yellow-marked circles, and green-marked circles represent the normal and faulty data, original neighbors, and shared neighbors of the TEP, respectively.