Just-in-Time software defect prediction (JIT-SDP) prevents the introduction of defects into the software by identifying them at commit check-in time. Current defect prediction approaches rely on manually crafted features such as change metrics and involve expensive to train machine learning or deep learning models. These models typically involve extensive training processes that may require significant computational resources and time. These characteristics can pose challenges when attempting to update the models in real-time as new examples become available, potentially impacting their suitability for fast online defect prediction. Furthermore, the reliance on a complex underlying model makes these approaches often less explainable, which means the developers cannot understand the reasons behind models' predictions. An approach that is not explainable might not be adopted in real-life development environments because of developers' lack of trust in its results. To address these limitations, we propose an approach called IRJIT that employs information retrieval on source code and labels new commits as buggy or clean based on their similarity to past buggy or clean commits. IRJIT approach is online and explainable as it can learn from new data without expensive retraining, and developers can see the documents that support a prediction, providing additional context. By evaluating 10 open-source datasets in a within project setting, we show that our approach is up to 23 times faster than the state-of-the-art, offers explainability at the commit and line level, and has comparable performance to the state-of-the-art.
翻译:即时软件缺陷预测(JIT-SDP)通过在提交检查时识别缺陷,从而防止缺陷引入软件。当前缺陷预测方法依赖手动设计的特征(如变更度量),并需要训练昂贵的机器学习或深度学习模型。这些模型通常涉及大量训练过程,可能消耗大量计算资源和时间。当需要根据新样本实时更新模型时,这些特性可能带来挑战,影响其适用于快速在线缺陷预测的可行性。此外,对复杂底层模型的依赖使得这些方法通常缺乏可解释性,导致开发者无法理解模型预测背后的原因。若方法不可解释,开发者可能因缺乏对其结果的信任而拒绝在实际开发环境中采用。为解决这些局限,我们提出一种名为IRJIT的方法,该方法对源代码执行信息检索,并根据新提交与历史缺陷提交或干净提交的相似性,将其标记为含缺陷或干净。IRJIT方法是在线且可解释的,因为它无需昂贵的重新训练即可从新数据中学习,且开发者可查看支持预测的文档以获得额外上下文。通过在10个开源数据集上进行项目内评估,我们证明该方法的速度比现有最优方法快23倍,在提交级别和行级别提供可解释性,且性能与现有最优方法相当。