Probabilistic model for code with decision trees
Authors:
Open Access
- 19 October 2016
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 731-747
Abstract
In this paper we introduce a new approach for learning precise and general probabilistic models of code based on decision tree learning. Our approach directly benefits an emerging class of statistical programming tools which leverage probabilistic models of code learned over large codebases (e.g., GitHub) to make predictions about new programs (e.g., code completion, repair, etc). The key idea is to phrase the problem of learning a probabilistic model of code as learning a decision tree in a domain specific language over abstract syntax trees (called TGen). This allows us to condition the prediction of a program element on a dynamically computed context. Further, our problem formulation enables us to easily instantiate known decision tree learning algorithms such as ID3, but also to obtain new variants we refer to as ID3+ and E13, not previously explored and ones that outperform ID3 in prediction accuracy. Our approach is general and can be used to learn a probabilistic model of any programming language. We implemented our approach in a system called Deep3 and evaluated it for the challenging task of learning probabilistic models of JavaScript and Python. Our experimental results indicate that Deep3 predicts elements of JavaScript and Python code with precision above 82% and 69%, respectively. Further, Deep3 often significantly outperforms state-of-the-art approaches in overall prediction accuracy.Keywords
This publication has 28 references indexed in Scilit:
- Suggesting accurate method and class names2015
- Graph-Based Statistical Language Model for Code2015
- Code completion with statistical language modelsACM SIGPLAN Notices, 2014
- Synthesis modulo recursive functions2013
- A statistical semantic language model for source code2013
- Complete completion using types and weights2013
- Program sketchingInternational Journal on Software Tools for Technology Transfer, 2012
- Combinatorial sketching for finite programsACM SIGPLAN Notices, 2006
- The zero-frequency problem: estimating the probabilities of novel events in adaptive text compressionIEEE Transactions on Information Theory, 1991
- Induction of decision treesMachine Learning, 1986