Yi Liu, Yiming Yin, Jia Deng, Weimin Li, Zhichao Peng
{"title":"完成 API 的组合策略:深度学习与启发式方法","authors":"Yi Liu, Yiming Yin, Jia Deng, Weimin Li, Zhichao Peng","doi":"10.3390/electronics13183669","DOIUrl":null,"url":null,"abstract":"Remembering software library components and mastering their application programming interfaces (APIs) is a daunting task for programmers, due to the sheer volume of available libraries. API completion tools, which predict subsequent APIs based on code context, are essential for improving development efficiency. Existing API completion techniques, however, face specific weaknesses that limit their performance. Pattern-based code completion methods that rely on statistical information excel in extracting common usage patterns of API sequences. However, they often struggle to capture the semantics of the surrounding code. In contrast, deep-learning-based approaches excel in understanding the semantics of the code but may miss certain common usages that can be easily identified by pattern-based methods. Our insight into overcoming these challenges is based on the complementarity between these two types of approaches. This paper proposes a combinatorial method of API completion that aims to exploit the strengths of both pattern-based and deep-learning-based approaches. The basic idea is to utilize a confidence-based selector to determine which type of approach should be utilized to generate predictions. Pattern-based approaches will only be applied if the frequency of a particular pattern exceeds a pre-defined threshold, while in other cases, deep learning models will be utilized to generate the API completion results. The results showed that our approach dramatically improved the accuracy and mean reciprocal rank (MRR) in large-scale experiments, highlighting its utility.","PeriodicalId":11646,"journal":{"name":"Electronics","volume":null,"pages":null},"PeriodicalIF":2.6000,"publicationDate":"2024-09-15","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"A Combinatorial Strategy for API Completion: Deep Learning and Heuristics\",\"authors\":\"Yi Liu, Yiming Yin, Jia Deng, Weimin Li, Zhichao Peng\",\"doi\":\"10.3390/electronics13183669\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Remembering software library components and mastering their application programming interfaces (APIs) is a daunting task for programmers, due to the sheer volume of available libraries. API completion tools, which predict subsequent APIs based on code context, are essential for improving development efficiency. Existing API completion techniques, however, face specific weaknesses that limit their performance. Pattern-based code completion methods that rely on statistical information excel in extracting common usage patterns of API sequences. However, they often struggle to capture the semantics of the surrounding code. In contrast, deep-learning-based approaches excel in understanding the semantics of the code but may miss certain common usages that can be easily identified by pattern-based methods. Our insight into overcoming these challenges is based on the complementarity between these two types of approaches. This paper proposes a combinatorial method of API completion that aims to exploit the strengths of both pattern-based and deep-learning-based approaches. The basic idea is to utilize a confidence-based selector to determine which type of approach should be utilized to generate predictions. Pattern-based approaches will only be applied if the frequency of a particular pattern exceeds a pre-defined threshold, while in other cases, deep learning models will be utilized to generate the API completion results. The results showed that our approach dramatically improved the accuracy and mean reciprocal rank (MRR) in large-scale experiments, highlighting its utility.\",\"PeriodicalId\":11646,\"journal\":{\"name\":\"Electronics\",\"volume\":null,\"pages\":null},\"PeriodicalIF\":2.6000,\"publicationDate\":\"2024-09-15\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Electronics\",\"FirstCategoryId\":\"5\",\"ListUrlMain\":\"https://doi.org/10.3390/electronics13183669\",\"RegionNum\":3,\"RegionCategory\":\"工程技术\",\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q2\",\"JCRName\":\"COMPUTER SCIENCE, INFORMATION SYSTEMS\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Electronics","FirstCategoryId":"5","ListUrlMain":"https://doi.org/10.3390/electronics13183669","RegionNum":3,"RegionCategory":"工程技术","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q2","JCRName":"COMPUTER SCIENCE, INFORMATION SYSTEMS","Score":null,"Total":0}
引用次数: 0
摘要
由于可用库数量庞大,记住软件库组件并掌握其应用编程接口(API)对程序员来说是一项艰巨的任务。根据代码上下文预测后续 API 的 API 补全工具对于提高开发效率至关重要。然而,现有的应用程序接口补全技术面临着限制其性能的特定弱点。基于模式的代码完成方法依赖于统计信息,在提取 API 序列的常见使用模式方面表现出色。但是,它们往往难以捕捉到周围代码的语义。相比之下,基于深度学习的方法在理解代码语义方面表现出色,但可能会遗漏某些基于模式的方法可以轻松识别的常见用法。我们对克服这些挑战的见解基于这两类方法之间的互补性。本文提出了一种完成 API 的组合方法,旨在利用基于模式的方法和基于深度学习的方法的优势。其基本思想是利用基于置信度的选择器来确定应采用哪种方法来生成预测。只有当特定模式的频率超过预先设定的阈值时,才会应用基于模式的方法,而在其他情况下,将利用深度学习模型生成 API 完成结果。结果表明,在大规模实验中,我们的方法显著提高了准确率和平均倒数等级(MRR),凸显了其实用性。
A Combinatorial Strategy for API Completion: Deep Learning and Heuristics
Remembering software library components and mastering their application programming interfaces (APIs) is a daunting task for programmers, due to the sheer volume of available libraries. API completion tools, which predict subsequent APIs based on code context, are essential for improving development efficiency. Existing API completion techniques, however, face specific weaknesses that limit their performance. Pattern-based code completion methods that rely on statistical information excel in extracting common usage patterns of API sequences. However, they often struggle to capture the semantics of the surrounding code. In contrast, deep-learning-based approaches excel in understanding the semantics of the code but may miss certain common usages that can be easily identified by pattern-based methods. Our insight into overcoming these challenges is based on the complementarity between these two types of approaches. This paper proposes a combinatorial method of API completion that aims to exploit the strengths of both pattern-based and deep-learning-based approaches. The basic idea is to utilize a confidence-based selector to determine which type of approach should be utilized to generate predictions. Pattern-based approaches will only be applied if the frequency of a particular pattern exceeds a pre-defined threshold, while in other cases, deep learning models will be utilized to generate the API completion results. The results showed that our approach dramatically improved the accuracy and mean reciprocal rank (MRR) in large-scale experiments, highlighting its utility.
ElectronicsComputer Science-Computer Networks and Communications
CiteScore
1.10
自引率
10.30%
发文量
3515
审稿时长
16.71 days
期刊介绍:
Electronics (ISSN 2079-9292; CODEN: ELECGJ) is an international, open access journal on the science of electronics and its applications published quarterly online by MDPI.