Abstract:It is costly to identify bugs from numerous source code files in a large software project. Thus, locating bug automatically and effectively becomes a worthy problem. Bug report is one of the most valuable source of bug description, and precisely locating related source codes linked to the bug reports can help reducing software development cost. Currently, most of the research on bug localization based on deep neural networks focus on design of network structures while lacking attention to the loss function, which impacts the performance significantly in prediction tasks. In this paper, a cost-sensitive margin distribution optimization (CSMDO) loss function is proposed and applied to deep neural networks. This new method is capable of handling the imbalance of software defect data sets, and improves the accuracy significantly.