## 3 Theoretical Background  
### Relief Algorithm  
[PERSON] et al. proposed Relief in 1992 [16]. This method borrows the idea of the nearest neighbor learning algorithm. Its theoretical basis is that a good feature should make the eigenvalues of the same type of samples in the nearest neighbor the same or similar. However, the values of different samples of the nearest neighbor are different or very different. Accordingly, each feature is assigned a corresponding weight to sort it. The greater the weight of the feature, the stronger its classification ability. In contrast, lower weight indicates that the classification ability of the features is weaker. The corresponding feature selection can be performed by setting the threshold of the feature weight or the number of feature subsets.  
However, Relief is effective only when the training samples are divided into two categories. [PERSON] extended the Relief algorithm to the Relief algorithm, which can be applied to multi-class sample cases [17; 18]. When dealing with multi-class problems, the algorithm selects the nearest neighbor sample from each different class sample instead of  
Figure 3: Flowchart of the detection process.  
selecting from all different samples. We select \(k\) nearest neighbor samples, take the average value to obtain each feature weight, and then obtain the correlation of each feature in each sample instance with the class. We can then set a threshold to determine whether the features are valid or invalid or select the features with the largest m' weights and remove other features.  
The Relieff algorithm is described in Algorithm 1 Relieff.  
```
Input: Dataset \(D\)  Number of examples to be selected by the algorithm \(m\)  Number of nearest neighbors \(k\)  Output: Vector of feature importance values \(W\)
```
1: Initialize: set all weight \(W[A_{l}]=0,l=1,\,2,\ldots,L\)-\(1,L\)
2:for\(i=1\) to \(m\)do
3: randomly select an instance \(R_{i}\) from \(D\)
4: find \(k\) nearest hits \(H_{j}\) of \(R_{i}\)
5:for each class \(C\)\(\
eq\) class (\(R_{i}\)) do
6: from class \(C\) find k nearest misses \(M_{j}(c)\) of \(R_{i}\)
7:endfor
8:for\(l=1\) to \(L\)do
9:\(W(A_{l})=W(A_{l})-\sum\limits_{j=1}^{k}diff\big{(}A_{l},R_{i},H_{j}\big{)}/(m \cdot k)\) \(+\sum\limits_{C\
eq l\)\(\
eq\) class(\(R_{i}\))}\(\Bigg{[}\frac{p(c)}{1-p(class(R_{i}))}\sum\limits_{j=1}^{k}diff \big{(}A_{l},R_{i},M_{j}(C)\big{)}\Bigg{]}/(m\cdot k)\)
10:endfor
11:endfor ```  
**Algorithm 1** Relieff  
In the algorithm, \(H\) represents the nearest neighbor sample of the same type as \(R\), \(M\) represents the nearest neighbor sample of the same type as \(R\), \(p(c)\) represents the distribution probability of the class, and the function \(diff\) is used to calculate the difference between the features of two different samples \(Instance_{1}\) and \(Instance_{2}\) as follows.  
For discrete features:  
\[diff\big{(}A_{l},R_{i},H_{j}\big{)}=\left\{\begin{array}{ll}0;&value(A,I_{1} )=value(A,I_{2})\\ 1;&otherwise\end{array}\right. \tag{1}\]  
For continuous features:  
\[diff\big{(}A_{l},R_{i},H_{j}\big{)}=\frac{value(A,I_{1})-value(A,I_{2})}{\max( A)-\min(A)} \tag{2}\]  
Here, \(I_{1}\) and \(I_{2}\) are two samples, and \(value(A,I_{1})\) refers to the value of the \(A\)th feature of sample \(I_{1}\). After finding the relevance weights \(W\) of each feature and class, they are sorted; the features whose relevance is greater than a certain threshold value constitute the final feature subset such that invalid features are eliminated.