# Cross-Project Defect Prediction Based on Domain Adaptation and LSTM Optimization
## 3 Methodology
### Proposed Features Selection Approach
The Bi-directional Gated Recurrent Unit (Bi-GRU) has the ability to learn knowledge from prior and subsequent data when dealing with the present data. Two unidirectional GRUs pointing in different directions are used to determine the state of the bi-_GRU_ model. One _GRU_ starts at the beginning of the data series and goes forward, and another _GRU_ starts at the end and moves backward. This makes it possible for information from the past and the future to affect the states that are currently in effect now. The bi-_GRU_ is defined by Equations (8)-(10), where \(\overset{\rightarrow}{h_{t}}\) is the state of the forward _GRU_, \(\overset{\leftarrow}{h_{t}}\) is the state of the backward _GRU_, and \(\oplus\) signifies the operation of concatenating two vectors. The model is able to produce more precise predictions because of this bi-directional representation, which records contextual information from both the past and the future. Figure 1:2

Figure 1:3

Figure 1:4

Figure 1:5

Figure 1:6

Figure 1:7

Attention Layer: We embed the attention layer solely in order to amplify the influence of features and focus more on key features, as shown in Equation (11). First, we input the values \(u_{it}\) representing the hidden states to be scaled. Figure 1:8

Then, to identify the important sequence's properties, \(u_{n}\) is employed. The normalized adaptive weights are then produced by the model using a softmax process by computing the dot product between \(u_{it}\) and \(u_{n}\), as shown in Equation (12). Figure 1:9

Ultimately, the sequence vector is generated by the weighted summation of each node, as shown in Equation (13). Figure 2:0

## 4 Experimental Setups

We provide a detailed description of our experimental setup in this part, together with benchmark datasets, evaluation metrics, baseline methods and research questions. ### Benchmark Datasets

The experiments were conducted on 10 open-source software projects from AEEEM (five JAVA open-source projects) and PROMISE (five projects randomly picked from PROMISE). The difficulty of the software development process and the complexity of the software code is considered when assembling and gathering the AEEEM database by [PERSON] [48]. The PROMISE dataset, which contains the most varied project features, was created by [PERSON] and [PERSON] [49]. Table 2 presents the detailed information of selected projects, including the projects names, numbers of instances and the percentage of defective modules. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Dataset** & **Project** & **Number of Instances** & **Defective Instances \%** \\ \hline \multirow{6}{*}{AEEEM} & EQ & 325 & 39.692 \\  & JDT & 997 & 20.662 \\  & LC & 399 & 16.040 \\  & ML & 1862 & 13.158 \\  & PDE & 1492 & 14.008 \\ \hline \multirow{6}{*}{PROMISE} & Ivy2.0 & 352 & 11.36 \\  & Poi3.0 & 442 & 64.09 \\ \cline{1-1}  & Xerces1.4 & 508 & 76.81 \\ \cline{1-1}  & Synapse1.2 & 256 & 33.63 \\ \cline{1-1}  & Xalan2.6 & 875 & 53.13 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Description of the datasets that we have chosen. ### Evaluation Metrics

We analyze our suggested model performance based on two evaluation metrics, F1-measure and _AUC_. The F1-measure is a typical evaluation metric used to evaluate the performance of a classification model. It is the precision and recall harmonic mean that balances the two metrics, as shown in Equation (14):

\[F1\text{-}Measure=\frac{2(Precision\times Recall)}{Precision+Recall} \tag{14}\]

Area Under the Receiver Operating Characteristic curve (_AUC_) is used to evaluate the degree of differentiation obtained by the model. Decision thresholds, like recall and precision, are insensitive to this. All potential classification thresholds are represented by a graphic that shows the true positive rate on the \(y\)-axis and the false positive rate on the \(x\)-axis, as shown in Equation (15).