CodeKernel: A Graph Kernel based Approach to the Selection of API Usage Examples

被引:22
|
作者
Gu, Xiaodong [1 ,3 ]
Zhang, Hongyu [2 ]
Kim, Sunghun [1 ,3 ]
机构
[1] Hong Kong Univ Sci & Technol, Hong Kong, Peoples R China
[2] Univ Newcastle, Callaghan, NSW, Australia
[3] NAVER Corp, Clova AI Res, Seongnam Si, South Korea
关键词
CLASSIFICATION;
D O I
10.1109/ASE.2019.00061
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
Developers often want to find out how to use a certain API (e.g., FileReader.read in JDK library). API usage examples are very helpful in this regard. Over the years, many automated methods have been proposed to generate code examples by clustering and summarizing relevant code snippets extracted from a code corpus. These approaches simplify source code as method invocation sequences or feature vectors. Such simplifications only model partial aspects of the code and tend to yield inaccurate examples. We propose CodeKernel, a graph kernel based approach to the selection of API usage examples. Instead of approximating source code as method invocation sequences or feature vectors, CodeKernel represents source code as object usage graphs. Then, it clusters graphs by embedding them into a continuous space using a graph kernel. Finally, it outputs code examples by selecting a representative graph from each cluster using designed ranking metrics. Our empirical evaluation shows that CodeKernel selects more accurate code examples than the related work (MUSE and EXOADOCS). A user study involving 25 developers in a multinational company also confirms the usefulness of CodeKernel in selecting API usage examples.
引用
收藏
页码:602 / 613
页数:12
相关论文
共 50 条
  • [31] Usage of a graph database for the selection of sterile items in the OR
    Mueller, C.
    Bernhard, L.
    Wilhelm, D.
    INTERNATIONAL JOURNAL OF COMPUTER ASSISTED RADIOLOGY AND SURGERY, 2023, 18 (05) : 871 - 875
  • [32] Usage of a graph database for the selection of sterile items in the OR
    C. Müller
    L. Bernhard
    D. Wilhelm
    International Journal of Computer Assisted Radiology and Surgery, 2023, 18 : 871 - 875
  • [33] Visualization Based API Usage Patterns Refining
    Saied, Mohamed Aymen
    Benomar, Omar
    Sahraoui, Houari
    2015 IEEE 3RD WORKING CONFERENCE ON SOFTWARE VISUALIZATION (VISSOFT), 2015, : 155 - 159
  • [34] PPGCN: A Message Selection Based Approach for Graph Classification
    Liu, Xinyang
    Liu, Zheng
    Qu, Yanwen
    NEURAL INFORMATION PROCESSING (ICONIP 2019), PT IV, 2019, 1142 : 112 - 121
  • [35] Feature grouping and selection: A graph-based approach
    Zheng, Ling
    Chao, Fei
    Mac Parthalain, Neil
    Zhang, Defu
    Shen, Qiang
    INFORMATION SCIENCES, 2021, 546 : 1256 - 1272
  • [36] A graph based requirements clustering approach for component selection
    Khan, Muhammad Ali
    Mahmood, Sajjad
    ADVANCES IN ENGINEERING SOFTWARE, 2012, 54 : 1 - 16
  • [37] Kernel approach to molecular similarity based con iterative graph similarity
    Rupp, Matthias
    Proschak, Ewgenij
    Schneider, Gisbert.
    JOURNAL OF CHEMICAL INFORMATION AND MODELING, 2007, 47 (06) : 2280 - 2286
  • [38] A novel power-based approach to Gaussian kernel selection in the kernel-based association test
    Zhan, Xiang
    Ghosh, Debashis
    STATISTICAL METHODOLOGY, 2016, 33 : 180 - 191
  • [39] An API Learning Service for Inexperienced Developers Based on API Knowledge Graph
    Yin, Hang
    Zheng, Yuanhao
    Sun, Yanchun
    Huang, Gang
    2021 IEEE INTERNATIONAL CONFERENCE ON WEB SERVICES, ICWS 2021, 2021, : 251 - 261
  • [40] A fast all-packets-based DDoS attack detection approach based on network graph and graph kernel
    Liu, Xinqian
    Ren, Jiadong
    He, Haitao
    Zhang, Bing
    Song, Chen
    Wang, Yunxue
    JOURNAL OF NETWORK AND COMPUTER APPLICATIONS, 2021, 185