Font Size: a A A

AUPLearner:A Code-context-sensitive Self-updating API Recommendation Approach

Posted on:2019-03-09Degree:MasterType:Thesis
Country:ChinaCandidate:Q Q JiaFull Text:PDF
GTID:2428330545985130Subject:Computer Science and Technology
Abstract/Summary:PDF Full Text Request
In recent years,code reuse is widely adopted for improving development efficiency.In particular,the usage of Application Programming Interface(API)is one of the major forms of code reuse.Although developers are enjoying the convenience brought by APIs,an important problem they encounter is how to choose an appropriate API from a large API library.It is time-consuming and error-prone to choose an appro-priate API method by reading large-scale API documents.In order to help developers to choose an appropriate API with a lower cost,many API recommendation approaches have been proposed to intelligently recommend the next possible called API for developers according to the development context,such as SLANG,GraLan and APIREC.These approaches have a certain degree of complexity either in the acquisition of experimental data sets or in model training.For example,APIREC,proposed by Nguyen et al.,uses statistical learning from fine-grained changes for API recommendations,and shows that its performance is superior to a variety of benchmark approaches according to experimental results.However,APIREC needs to mine fine-grained history changes,which is a complicated process,and consumes a lot of storage space.Moreover,APIREC would take a lot of time to train the recommendation model.Based on the research status,this thesis is devoted to find a simple yet effective API recommendation approach to achieve similar or better recommendation performance than existing complex approaches.The main contributions of this thesis are as follows:(1)Propose AUPLearner,a code-context-sensitive self-updating API recommendation approach,to recommend the next possible called API for developers.AUPLearner combines single-class API usage sequence and surrounding token list in code context for API recommendation.On the one hand,AUPLearner leverages a N-Gram language model to capture the order that exists between single-class API usage sequences.On the other hand,AUPLearner leverages an association rule mining algorithm to mine the rule between each API and its surrounding tokens in each class.Furthermore,after each API recommendation,AUPLearner updates itself using the historical API usage sequence,the tokens surrounding on the recommendation point,and the target API.In particular,in order to reduce the complexity,AUPLearner adopts 2-Gram language model,and only mines 2-frequent itemsets.(2)Analyze the overall performance of AUPLearner in the open-source projects.The results show that the Accuracy@top-5 of AUPLearner is nearly 90%,which is close to the recommendation accuracy of the optimal approach,and the computation cost of AUPLearner is less than 30ms.The results indicate that AUPLearner is a cost-effective approach in API recommendation.(3)Design experiments to compare the performance of AUPLearner with baseline approaches,APIREC and NGram.The results show that AUPLearner outperforms the baseline approaches in API recommendation.In particular,when compared with the state-of-the-art approach APIREC by Nguyen et al.,AUPLearner exhibits a large improvement:under cross-project recommendation,the average improvement of Accuracy@top-1 is 160%(120%)for general API recommendation(JDK API recommendation),and under within-project recommendation,the average improvement of Accuracy@top-1 is 81%(77%)for general API recommendation(JDK API recommendation).
Keywords/Search Tags:Code context, API usage sequence, token list, N-Gram language model, association rule mining, self-updating
PDF Full Text Request
Related items