ROSF: Leveraging Information Retrieval and Supervised Learning for Recommending Code Snippets
He Jiang, Liming Nie, Zeyi Sun, Zhilei Ren, Weiqiang Kong, Tao Zhang,, Xiapu Luo

TL;DR
ROSF is a novel approach that combines information retrieval and supervised learning to improve code snippet recommendations, significantly outperforming existing methods in large-scale experiments.
Contribution
This paper introduces ROSF, a two-stage method integrating IR and supervised learning for more accurate code snippet recommendations.
Findings
ROSF outperforms state-of-the-art methods by 20%-41% in Precision.
ROSF improves NDCG scores by 13%-33%.
Effective in large-scale real-world code corpus.
Abstract
When implementing unfamiliar programming tasks, developers commonly search code examples and learn usage patterns of APIs from the code examples or reuse them by copy-pasting and modifying. For providing high-quality code examples, previous studies present several methods to recommend code snippets mainly based on information retrieval. In this paper, to provide better recommendation results, we propose ROSF, Recommending cOde Snippets with multi-aspect Features, a novel method combining both information retrieval and supervised learning. In our method, we recommend Top-Kcode snippets for a givenfree-form query based on two stages, i.e., coarse-grained searching and fine-grained re-ranking. First, we generate a code snippet candidate set by searching a code snippet corpus using an information retrieval method. Second, we predict probability values of the code snippets for different…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
