Improving Clone Detection Precision Using Machine Learning Techniques

Vara Arammongkolvichai, Rainer Koschke, Chaiyong Ragkhitwetsagul, Morakot Choetkiertikul, Thanwadee T. Sunetnanta · 2019

Code clones or similar segments of code in a software project can be detected by using a clone detection tool. Due to modifications applied after copying and pasting of the cloned code, the current code clone detection tools face challenges to accurately detect clones with heavy modifications (i.e., Type-3 clones or clones with added/deleted/modified statements). One challenge is because the clone results contain several false positives. In this paper, we propose an approach for increasing the precision of code clone detection using machine learning techniques. By training a decision tree on 19 clone class metrics, we use the trained decision tree as a clone filter by placing it in the last step in the clone detection pipeline. This aims to remove false positive clone classes reported by a clone detection tool. We found that the decision tree clone filter is helpful for decreasing the number of false positive clone classes in iClones, a well-known code clone detector. After training the decision tree on 537 clone classes in JFreeChart and evaluating it on the test data set, it could improve iClone's precision from 0.94 to 0.98. The findings show that decision tree can be used effectively for filtering false positive clones. Nonetheless, we found that the filter is only effective for Java and does not offer satisfying performance when running on a Django Python project.

Read the paper · More papers on PaperTik