论文标题

通过多视图异质图表示学习的API使用建议

API Usage Recommendation via Multi-View Heterogeneous Graph Representation Learning

论文作者

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

论文摘要

开发人员通常需要确定用于实施功能的API。随着不断增长的API和库,开发人员很难找到适当的API,这表明需要自动使用API​​使用建议。先前的研究采用统计模型或协作过滤方法来挖掘建议的隐式API使用模式。但是,它们依靠API的发生频率用于采矿使用模式,因此容易因低频API而失败。此外,先前的研究通常将API调用相互作用图视为均匀图,而忽略了结构图中的丰富信息(例如边缘类型)。在这项工作中,我们提出了一种名为Mega的新方法,以提高建议准确性,尤其是对于低频API。具体而言,除了调用交互图外,Mega还考虑了另外两个新的异质图:全局API共发生图,富含API频率信息和层次结构图,并富含项目组件信息。有了三个多视图异质图,Mega可以更准确地捕获API使用模式。在三个Java基准数据集上的实验表明,对于成功率@1度量,大型巨型的表现显着优于基线模型,至少超过了19%。特别是,对于低频API,Mega在1@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.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源