Context-Aware Based API Recommendation with Diversity

被引:0
|
作者
Lai B. [1 ]
Li Z. [1 ]
Zhao R. [1 ]
Guo J. [1 ]
机构
[1] College of Information Science and Technology, Beijing University of Chemical Technology, Beijing
基金
中国国家自然科学基金;
关键词
API recommendation; API usage pattern; diversity recommendation; graph model; reordering;
D O I
10.7544/issn1000-1239.202220317
中图分类号
学科分类号
摘要
When facing API usage problems during the development process, software developers usually hope to get effective suggestions on API usage patterns to help them learn and use. Traditional API recommendation methods mine the usage knowledge of APIs in the codebase, and then recommend context-sensitive APIs to developers. However, several aspects affect the performance of the recommendation, such as the insufficient representation of contextual information, the appearance of redundant and homogeneous contents in the recommendation list. Focus on those problems, we propose an approach named as context-aware based API recommendation with diversity (CAPIRD), in which we build an API hierarchy call graph (AHCG) model of projects, methods, and APIs to represent API contextual relationships better. According to AHCG model, we can fully use API structural and semantic information to reduce redundant and homogenous contents. In addition, the measurement of relevance and correlation parts are introduced into the approach, which are used to maximize the relevant results, while balancing the correlation of selected APIs and candidate APIs, so as to dig out a reasonable list of APIs. Finally, we reorder the above relevant and correlated results using the optimal weight combination to increase the diversity. The optimal weight is learned on the standard patterns datasets combined with the maximal marginal relevance algorithm. Experiments are implemented on 3 datasets, which are consisted of 2 210 projects, to verify the recommendation performance of CAPIRD. The experimental results show that CAPIRD performs better in context-based scenarios of API usage recommendation. In detail, compared with the baseline approaches, the average improvement of MAP (mean average precision) is about 9%. In the Top-1 success rate, the average improvement is about 13%. © 2023 Science Press. All rights reserved.
引用
下载
收藏
页码:2335 / 2347
页数:12
相关论文
共 35 条
  • [1] Dong Qiu, Bixin Li, Leung H., Understanding the API usage in Java[J], Information and Software Technology, 73, (2016)
  • [2] Treude C, Robillard M P., Augmenting API documentation with insights from stack overflow[C], Proc of the 38th Int Conf on Software Engineering (ICSE), pp. 392-403, (2016)
  • [3] Aghajani E, Nagy C, Vega-Marquez O L, Et al., Software documentation issues unveiled[C], Proc of the 41st Int Conf on Software Engineering (ICSE), pp. 1199-1210, (2019)
  • [4] Li Hongwei, Li Sirui, Sun Jiamou, Et al., Improving API caveats accessibility by mining API caveats knowledge graph[C], Proc of the 34th IEEE Int Conf on Software Maintenance and Evolution (ICSME), pp. 183-193, (2018)
  • [5] Bhasin T, Murray A, Storey M A., Student experiences with GitHub and stack overflow: An exploratory study[C], Proc of the 13th Int Workshop on Cooperative and Human Aspects of Software Engineering (CHASE), pp. 81-90, (2021)
  • [6] Uddin G, Robillard M P., How API documentation fails[J], IEEE Software, 32, 4, pp. 68-75, (2015)
  • [7] Yu Haibo, Song Wenhao, Mine T., Apibook: An effective approach for finding APIs[C], Proc of the 8th Asia-Pacific Symp on Int, pp. 45-53, (2016)
  • [8] Zhong Hao, Xie Tao, Zhang Lu, Et al., MAPO: Mining and recommending API usage patterns[C], Proc of the 23rd European Conf on Object-Oriented Programming, pp. 318-343, (2009)
  • [9] Jue Wang, Dang Yingnong, Zhang Hongyu, Et al., Mining succinct and high-coverage API usage patterns from source code[C], Proc of the 10th Working Conf on Mining Software Repositories (MSR), pp. 319-328, (2013)
  • [10] Fowkes J, Sutton C., Parameter-free probabilistic API mining across GitHub[C], Proc of the 24th ACM SIGSOFT Int Symp on Foundations of Software Engineering, pp. 254-265, (2016)