APIGAN: Learning to Recommend Java API in Real-Time Using Generative Adversarial Networks

In order to improve the accuracy of API recommendations, this paper proposes a novel API recommendation approach of APIGAN fully leveraging structural and textual information based on Generative Adversarial Networks, in which a Long Short-Term Memory (LSTM) is used as a generator while a Convolutional Neural Network (CNN) is used as a discriminator. The structural and semantic information of a source code extracted from an abstract syntax tree is used to construct a program dependence graph (PDG) which is also the input of the generator and the discriminator. By evaluating the difference in outputs of them, LSTM is evolved gradually till an optimized program dependence network is obtained to recommend top-k APIs. The results of the experiments show that APIGAN outperforms state-of-the-art research such as APIREC, GraLan, and n-gram in the aspect of top-k accuracy.