Skip to main content
QUICK REVIEW

[论文解读] How to Recognize Actionable Static Code Warnings (Using Linear SVMs)

Xueqi Yang, Jianfeng Chen|arXiv (Cornell University)|May 31, 2020
Software Engineering ResearchComputer Science被引用 9
一句话总结

本文提出使用线性支持向量机(SVM)从FindBugs中识别可操作的静态代码警告,实现了96%的中位召回率、2%的误报率,以及超过99%的AUC。作者发现数据本质上是简单的——实际上为低维——这解释了为何多种学习器表现相似,并建议在该场景下使用线性SVM,因其速度快且性能出色。

ABSTRACT

Static code warning tools often generate warnings that programmers ignore. Such tools can be made more useful via data mining algorithms that select the warnings; i.e. the warnings that are usually not ignored. But what is the best way to build those selection algorithms? To answer that question, we learn predictors for 5,675 actionable warnings seen in 31,058 static code warnings from FindBugs. Several data mining methods perform very well on this task. For example, linear Support Vector Machine achieved median recalls of 96%; median false alarms of 2%; and AUC(TNR, TPR) of over 99%. Other learners (tree-based methods and deep learning) achieved very similar results (usually, within 4% or less). On investigation, we found the reason for all these learners performing very well: the data was intrinsically very simple. Specifically, while our data sets have up to 58 raw features, those features can be approximated by less than two underlying dimensions. For such intrinsically simple data, many different kinds of learners can generate useful models with similar performance. Based on the above, we conclude that it is both simple and effective to use data mining algorithms for selecting warnings from static code analysis tools. Also, we recommend using linear SVMs to implement that selecting process (since, at least in our sample, that learner ran relatively quickly and achieved the best all-around performance). Further, for any analytics task, it important to match the complexity of the inference to the complexity of the data. For example, we would not recommend deep learning for finding actionable static code warnings since our data is intrinsically very simple.

研究动机与目标

  • 通过识别通常可操作的警告,提高静态代码警告工具的实用性,从而减少被忽略的可能性。
  • 评估并比较各种数据挖掘算法,以筛选出开发者更可能采取行动的警告。
  • 确定复杂模型(如深度学习)是否必要,或是否简单的模型已足够胜任此任务。
  • 研究静态代码警告数据的固有复杂性,以指导模型选择。

提出的方法

  • 从FindBugs收集了31,058个静态代码警告,并基于开发人员的反馈,将其中5,675个标记为可操作。
  • 为每个警告提取最多58个原始特征,包括代码度量、警告类型和结构属性。
  • 在标记数据上训练多种机器学习模型,包括线性SVM、基于树的方法和深度学习模型。
  • 使用标准指标评估模型:中位召回率、中位误报率,以及真阴性率(TNR)与真正性率(TPR)的AUC。
  • 进行维度分析,以评估数据的固有复杂性,发现其可由少于两个潜在维度近似。
  • 基于性能和推理速度选择最佳模型,推荐线性SVM用于实际部署。

实验结果

研究问题

  • RQ1在从大量FindBugs警告中识别可操作静态代码警告的任务中,哪种机器学习算法表现最佳?
  • RQ2静态代码警告数据的固有复杂性如何影响不同学习算法的性能?
  • RQ3在该场景下,是否线性SVM等简单模型的表现可优于深度神经网络等复杂模型?
  • RQ4静态代码警告中的特征在多大程度上反映了潜在的低维模式,从而使预测更容易?
  • RQ5鉴于数据的简单性以及简单模型的出色表现,是否证明深度学习在此任务中是合理的?

主要发现

  • 线性SVM在可操作警告上实现了96%的中位召回率和2%的中位误报率,AUC超过99%。
  • 基于树的方法和深度学习模型表现几乎相当,关键指标上的性能差异不超过4%。
  • 数据被发现本质上是简单的,所有特征可由少于两个潜在维度近似。
  • 数据的简单性解释了为何不同学习器(包括深度学习)表现相似,因为它们都捕捉到了低维结构。
  • 由于其出色的性能、快速的推理速度以及与数据低固有复杂性的适配性,推荐使用线性SVM。
  • 研究结论认为,将模型复杂度与数据复杂度相匹配至关重要,深度学习在此任务中并非必要。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。