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 条
  • [21] A Hybrid Pattern Knowledge Graph-Based API Recommendation Approach
    Wang, Guan
    Wang, Weidong
    Li, Dian
    ARTIFICIAL INTELLIGENCE, CICAI 2022, PT III, 2022, 13606 : 465 - 476
  • [22] A graph-based approach to feature selection
    Zhang Z.
    Hancock E.R.
    Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), 2011, 6658 LNCS : 205 - 214
  • [23] A Graph-Based Approach to Feature Selection
    Zhang, Zhihong
    Hancock, Edwin R.
    GRAPH-BASED REPRESENTATIONS IN PATTERN RECOGNITION, 2011, 6658 : 205 - 214
  • [24] Robust Gaussian kernel based approach for feature selection
    Hsiao, Chih-Ching
    Chuang, Chen-Chia
    Su, Shun-Feng
    Advances in Intelligent Systems and Computing, 2014, 268 : 25 - 33
  • [25] fine-GRAPE: fine-grained APi usage extractor - an approach and dataset to investigate API usage
    Sawant, Anand Ashok
    Bacchelli, Alberto
    EMPIRICAL SOFTWARE ENGINEERING, 2017, 22 (03) : 1348 - 1371
  • [26] fine-GRAPE: fine-grained APi usage extractor – an approach and dataset to investigate API usage
    Anand Ashok Sawant
    Alberto Bacchelli
    Empirical Software Engineering, 2017, 22 : 1348 - 1371
  • [27] Graph Embedding Based API Graph Search and Recommendation
    Chun-Yang Ling
    Yan-Zhen Zou
    Ze-Qi Lin
    Bing Xie
    Journal of Computer Science and Technology, 2019, 34 : 993 - 1006
  • [28] Graph Embedding Based API Graph Search and Recommendation
    Ling, Chun-Yang
    Zou, Yan-Zhen
    Lin, Ze-Qi
    Xie, Bing
    JOURNAL OF COMPUTER SCIENCE AND TECHNOLOGY, 2019, 34 (05) : 993 - 1006
  • [29] LogKernel: A Threat Hunting Approach Based on Behaviour Provenance Graph and Graph Kernel Clustering
    Li, Jiawei
    Zhang, Ru
    Liu, Jianyi
    Liu, Gongshen
    SECURITY AND COMMUNICATION NETWORKS, 2022, 2022
  • [30] LogKernel: A Threat Hunting Approach Based on Behaviour Provenance Graph and Graph Kernel Clustering
    Li, Jiawei
    Zhang, Ru
    Liu, Jianyi
    Liu, Gongshen
    Security and Communication Networks, 2022, 2022