arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2208.01971cs.SE
收藏

基于多视图异构图表示学习的API使用推荐

API Usage Recommendation via Multi-View Heterogeneous Graph Representation Learning

Yujia Chen, Xiaoxue Ren, Cuiyun Gao, Yun Peng, Xin Xia, Michael R. Lyu

摘要:

开发人员通常需要决定为正在实现的功能使用哪些API。随着API和库数量的不断增加,开发人员越来越难以找到合适的API,这表明自动API使用推荐的必要性。以往的研究采用统计模型或协同过滤的方法来挖掘隐含的API使用模式进行推荐。然而,它们依赖于API的出现频率来挖掘使用模式,因此对于低频API容易失败。此外,现有的研究一般将API调用交互图视为同构图,忽略了API调用交互图中的丰富信息(例如,边类型)的结构图中。在这项工作中,我们提出了一种新的方法,名为MEGA,以提高推荐精度,特别是对低频API。具体地说,除了调用交互图之外,MEGA还考虑了另外两个新的异构图:包含API频率信息的全局API共现图和包含项目组件信息的层次结构图。通过三个多视图异构图,MEGA可以更准确地捕捉API使用模式。在三个Java基准数据集上的实验表明,MEGA在Success Rate@1度量方面明显优于基线模型至少19%。特别是对于低频API,MEGA还将成功率@1的基线提高了至少55%。

英文摘要:

Developers often need to decide which APIs to use for the functions being implemented. With the ever-growing number of APIs and libraries, it becomes increasingly difficult for developers to find appropriate APIs, indicating the necessity of automatic API usage recommendation. Previous studies adopt statistical models or collaborative filtering methods to mine the implicit API usage patterns for recommendation. However, they rely on the occurrence frequencies of APIs for mining usage patterns, thus prone to fail for the low-frequency APIs. Besides, prior studies generally regard the API call interaction graph as homogeneous graph, ignoring the rich information (e.g., edge types) in the structure graph. In this work, we propose a novel method named MEGA for improving the recommendation accuracy especially for the low-frequency APIs. Specifically, besides call interaction graph, MEGA considers another two new heterogeneous graphs: global API co-occurrence graph enriched with the API frequency information and hierarchical structure graph enriched with the project component information. With the three multi-view heterogeneous graphs, MEGA can capture the API usage patterns more accurately. Experiments on three Java benchmark datasets demonstrate that MEGA significantly outperforms the baseline models by at least 19% with respect to the Success Rate@1 metric. Especially, for the low-frequency APIs, MEGA also increases the baselines by at least 55% regarding the Success Rate@1.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑