# Identify High-Impact Bug Reports by Combining the Data Reduction and Imbalanced Learning Strategies
## Appendix A
### Feature Selection Algorithm
#### a.2.2 Ig  
The IG algorithm is often used to assess the quality of features in machine learning. It calculates the accuracy of the classification algorithm including an attribute and not including an attribute. The IG assigns a weight to the attribute based on the difference between the two values. In the IG algorithm, the measure of word importance is mainly to consider how much information the word can provide for the classification algorithm. The more information it provides, the more important the word is, as shown in Algorithm 2. ```
1:\(C,A,a,s\)
2:\(P\leftarrow\emptyset\). 3:\(m\leftarrow\mathit{categories}(C)\)// categories(C) calculates the category number of C.
4:For each \(a\) in \(A\)
5:\(p(a)\leftarrow\mathit{appear}(C,a)\)// appear(C, a) means the probability of a appearing in C.
6:\(p(-a)\leftarrow\mathit{noappear}(C,a)\)// noappear(C, a) means the probability that a does not appear in C.
7:For each \(c\) in \(C\)
8:\(p(c_{a})\leftarrow\mathit{categories}(C,c_{a})\)// \(c_{a}\) means the categories of C that contain a. 9:\(P(c_{a}|a)\leftarrow\mathit{probability}(c_{a},a)\)// \(\mathit{probability}(c_{a},\text{a})\) means the probability that when a appears, \(c_{a}\) appears. 10:\(P(c_{a}|\mathit{high}-\mathit{dimensional})\leftarrow\mathit{probability}(c_{a},-a)\)// \(\mathit{probability}(c_{a},\text{-a})\) means the probability that when a does not appear, \(c_{a}\) appears. 11:endfor
12:\(G(a)=\sum\limits_{a}P(c_{a})\ast\log P(c_{a})+P(a)\times\sum\limits_{a}P(c_{t} \,|\,a)\log P(c_{t}\,|\,a)+P(|\,-\,a)\times\sum\limits_{a}P(c_{t}|-a)\log P(c_{ t}\,|\,|-a\,)\)// calculate the information gain of each a. 13:endfor
14:\(P\leftarrow\mathit{Sort}(G(a),s)\)Sort(G(a), s) means to sort G(a) and obtain the attribute of the former percent s.
15:Return \(P\)
```  
**Algorithm A1** OneR  
```
1:\(C,A,a,s\)
2:\(P,\mathit{the}\mathit{new}\mathit{featureselectionset}\)
3:\(C,A,a,s\)
4:\(P,\mathit{the}\mathit{new}\mathit{featureselectionset}\)
5:\(C,A,a,s\)


```
0:\(C,A,a,s\)
0:\(P\),the new featureselectionset
1:\(P\leftarrow\emptyset\). 2:\(R\leftarrow\emptyset\) // R is the chi-squared value set of \(A\). 3:\(D\leftarrow\ numbers(C)// numbers(C) means the number of \(C\). 4:\(M,N,J,Q\leftarrow\emptyset\)
5:For each \(a\) in \(A\)
6:For each \(c\) in \(C\)
7:\(M,N,J,Q\leftarrow\ values(A,C)\) // values(A, C) calculates the values of M, N, J, Q, respectively. 8:\(\chi^{2}\left(a,c\right)=\frac{(N+Q)\times(M+N)\times(J+Q)\times(M+J)}{(N+Q) \times(M+J)}\) // calculates the \(\chi^{2}\) of \(a\) for \(c\). 9:endfor
10:\(R\leftarrow\ findmax(\chi^{2}(a,c)\) ) // find the maximum chi-square value of \(a\). 11:endfor
12:\(P\leftarrow\ Sort(R,s)\) //sort \(R\) and obtain the attribute of the former percent \(s\). 13:Return \(P\)
```

**Algorithm A3** CHI

#### a.2.4 Relief

The Relief algorithm is a feature weighting algorithm that assigns different weights according to the correlation of each feature and category. The features with weights less than a certain threshold will be removed. The correlation of features and categories in the Relief algorithm is based on the ability of the features to distinguish between close-range samples. The algorithm randomly selects a sample \(R\) from the training set \(D\) and then searches for the nearest neighbor sample \(H\) from the samples of the same type \(R\), called Near Hit. Then, the algorithm finds the nearest neighbor sample \(M\) from the samples of different \(R\) types, called near miss, and updates the weight of each feature according to the following rules. If the distance between \(R\), near hit and a feature is less than the distance between \(R\) and near miss, it indicates that the feature is beneficial for distinguishing the nearest neighbors of the same type and different classes, and the weight of the feature is increased.