# LSTM Attention-Driven Similarity Learning for Effective Bug Localization
## 5 Experimental Result
### Result  
#### 5.5.1 Result of Our Approach  
Before evaluating the overall bug localization performance, an analysis was conducted to determine the impact of K in top-K code similarity learning, as shown in Figure 6. The X-axis represents the performance values, while the Y-axis denotes the evaluation metrics, including accuracy, mean reciprocal rank (MRR), and mean average precision (MAP). Selecting an appropriate K value is crucial, as it determines the number of candidate source code files retrieved based on their similarity to a given bug report before being processed by the LSTM-Attention model. If K is too low, the model may not consider enough relevant source code files, leading to missed bug localizations. If K is too high, the model may include irrelevant files, increasing computational complexity and reducing precision. For the six open-source projects used in this study, when K was set to 1, the average performance across all evaluation metrics was recorded at 71.08. When K was increased to 2, the performance improved to 79.09. This result suggests that incorporating one additional candidate file during similarity learning enhances the model's ability to correctly identify buggy files while maintaining a balance between precision and recall. Based on this analysis, K was set to 2 in the subsequent experiments to optimize bug localization performance. This configuration was used throughout this study to ensure consistent evaluation while maintaining efficiency in retrieving and ranking relevant source code files. Figure 6: Result of top-K Code Similarity-Learning. The performance of the proposed bug localization method is presented in Figures 7 and 8. In both figures, the x-axis represents the six open-source projects (Tomcat, Aspect), Birt, Eclipse, JDT, and SWT), while the y-axis represents performance values based on different evaluation metrics. Figure 7 illustrates the accuracy of the proposed model across different ranking thresholds (Top-1, Top-3, Top-5, Top-10, and Top-15). The results indicate that the model achieves higher accuracy as more candidate files are considered, with the best performance observed at higher K values. The average accuracy of the proposed method across all projects was approximately 79.09%, showing its effectiveness in identifying relevant buggy source code files. Figure 8 provides an evaluation of the model using the Mean Reciprocal Rank (MRR) and Mean Average Precision (MAP) metrics. The MRR score was approximately 0.68, indicating that the model consistently ranks correct buggy files near the top of the recommendation list. The MAP score was approximately 0.62, reflecting the model's ability to maintain precision across ranked recommendations. The relatively high MRR and MAP values suggest that the proposed method effectively prioritizes relevant buggy files, ensuring that they appear earlier in the ranked list. Figure 8: Evaluation of the proposed model using Mean Reciprocal Rank (MRR) and Mean Average Precision (MAP) metrics. Figure 7: Accuracy of the proposed model across different ranking thresholds (Top-1 to Top-15). Overall, the results confirm that the proposed bug localization approach exhibits strong predictive performance across multiple projects and ranking thresholds. The combination of top-K code similarity learning and the LSTM-Attention model contributes to improved accuracy and ranking effectiveness, making it a reliable method for automated bug localization in software maintenance tasks. A comparative analysis was conducted to assess the impact of top-K code similarity learning on the performance of the proposed bug localization model, as shown in Figure 9. The evaluation compared the model's accuracy with and without the application of top-K code similarity learning. When this technique was applied, the model achieved an accuracy of 79.09%, whereas without it, the accuracy decreased to 68.60%.