[论文解读] Parameter-Free Probabilistic API Mining at GitHub Scale
本文提出 PAM,一种近乎无参数的概率算法,用于从大规模 GitHub 代码库中挖掘有意义的 API 调用模式。通过利用来自 967 个客户端项目的手写示例代码(超过 300,000 行代码),PAM 在检索相关 API 序列时实现了 70% 的测试集精确率,显著优于 MAPO 和 UPMiner,同时减少了冗余并提升了可解释性。
Existing API mining algorithms are not yet practical to use as they require expensive parameter tuning and the returned set of API calls can be large, highly redundant and difficult to understand. In an attempt to remedy these shortcomings we present PAM (Probabilistic API Miner), a near parameter-free probabilistic algorithm for mining the most informative API call patterns. We show that PAM significantly outperforms both MAPO and UPMiner, achieving 70% test-set precision, at retrieving relevant API call sequences from GitHub. Moreover, we focus on libraries for which the developers have explicitly provided code examples, yielding over 300,000 LOC of hand-written API example code from the 967 client projects in the data set. This evaluation suggests that the hand-written examples actually have limited coverage of real API usages.
研究动机与目标
- 为解决现有 API 挖掘算法因需大量参数调优以及结果中冗余度过高而导致的不切实际问题。
- 开发一种可扩展的、近乎无参数的方法,用于识别大规模代码库中最具信息量的 API 调用序列。
- 通过分析手写示例与挖掘出的模式之间的对齐情况,评估真实场景中手写 API 示例在实际使用中的覆盖范围。
- 提升挖掘出的 API 模式的可解释性和实用性,以服务于开发者和开发工具。
提出的方法
- PAM 使用概率模型,根据代码中 API 调用序列的信息量和共现模式对其进行排序。
- 采用贝叶斯评分函数识别高概率序列,无需手动配置参数。
- 该方法利用来自 967 个 GitHub 客户端项目的手写示例代码(总计超过 300,000 行代码)作为真实情况和训练信号的来源。
- PAM 应用剪枝策略,以消除冗余和低信息量的序列,从而提升结果的清晰度。
- 该算法在大规模 GitHub 数据集上进行评估,与 MAPO 和 UPMiner 在精确率和召回率方面进行对比。
实验结果
研究问题
- RQ1与 MAPO 和 UPMiner 等现有方法相比,PAM 在检索相关 API 调用序列方面的有效性如何?
- RQ2客户端项目中的手写 API 示例在多大程度上反映了生产代码中实际的 API 使用模式?
- RQ3无参数方法是否能在大规模场景下实现高精确率的 API 调用模式挖掘?
- RQ4PAM 如何减少冗余并提升挖掘模式的可解释性?
主要发现
- PAM 在检索相关 API 调用序列时实现了 70% 的测试集精确率,显著优于 MAPO 和 UPMiner。
- 来自 967 个客户端项目的手写示例代码仅覆盖了真实 API 使用模式的一小部分,表明示例的完整性存在差距。
- PAM 减少了挖掘序列中的冗余,使 API 模式更具可解释性和可操作性。
- 该方法仅需极少的参数调优,使其在实际软件工程工作流中大规模应用成为可能。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。