API Usage Recommendation Via Multi-View Heterogeneous Graph Representation Learning

被引:8
作者
Chen, Yujia [1 ]
Gao, Cuiyun [1 ]
Ren, Xiaoxue [2 ]
Peng, Yun [2 ]
Xia, Xin [3 ]
Lyu, Michael R. R. [2 ]
机构
[1] Harbin Inst Technol, Shenzhen 518055, Guangdong, Peoples R China
[2] Chinese Univ Hong Kong, Hong Kong, Peoples R China
[3] Software Engn Applicat Technol Lab, Huawei 518129, Peoples R China
基金
中国国家自然科学基金; 国家重点研发计划;
关键词
Codes; !text type='Java']Java[!/text; Source coding; Benchmark testing; Software; Representation learning; Programming; API recommendation; graph representation learning; multi-view heterogeneous graphs;
D O I
10.1109/TSE.2023.3252259
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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 score.
引用
收藏
页码:3289 / 3304
页数:16
相关论文
共 37 条
  • [1] Acharya M, 2007, P JOINT M EUROPEAN S, P25, DOI 10.1145/1287624.1287630
  • [2] Agarap A. F., 2018, Deep learning using rectified linear units (relu)
  • [3] API Code Recommendation using Statistical Learning from Fine-Grained Changes
    Anh Tuan Nguyen
    Hilton, Michael
    Codoban, Mihai
    Hoan Anh Nguyen
    Mast, Lily
    Rademacher, Eli
    Nguyen, Tien N.
    Dig, Danny
    [J]. FSE'16: PROCEEDINGS OF THE 2016 24TH ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON FOUNDATIONS OF SOFTWARE ENGINEERING, 2016, : 511 - 522
  • [4] Graph-based Statistical Language Model for Code
    Anh Tuan Nguyen
    Nguyen, Tien N.
    [J]. 2015 IEEE/ACM 37TH IEEE INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING, VOL 1, 2015, : 858 - 868
  • [5] Nguyen AT, 2012, PROC INT CONF SOFTW, P1407, DOI 10.1109/ICSE.2012.6227236
  • [6] [Anonymous], 2006, TECHNOMETRICS
  • [7] Buse RPL, 2012, PROC INT CONF SOFTW, P782, DOI 10.1109/ICSE.2012.6227140
  • [8] Cosmo RD, 2017, P 14 INT C DIG PRES
  • [9] Daqing Hou, 2011, 2011 18th Working Conference on Reverse Engineering, P131, DOI 10.1109/WCRE.2011.24
  • [10] Parameter-Free Probabilistic API Mining across GitHub
    Fowkes, Jaroslav
    Sutton, Charles
    [J]. FSE'16: PROCEEDINGS OF THE 2016 24TH ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON FOUNDATIONS OF SOFTWARE ENGINEERING, 2016, : 254 - 265