Skip to main content
QUICK REVIEW

[Paper Review] Estimating defectiveness of source code: A predictive model using GitHub content

Ritu Kapur, Balwinder Sodhi|arXiv (Cornell University)|Mar 21, 2018
Software Engineering ResearchComputer Science16 references4 citations
TL;DR

This paper proposes a predictive model for estimating source code defectiveness using programming style features extracted from GitHub repositories. By mining 30,400 source files across 20 OSS projects in C, C++, Java, and Python, and integrating them with 14,950 bug reports, the authors train a machine learning model that achieves a mean F1 score of 0.914 using NuSVM, demonstrating strong performance in defect prediction based on coding style patterns.

ABSTRACT

Two key contributions presented in this paper are: i) A method for building a dataset containing source code features extracted from source files taken from Open Source Software (OSS) and associated bug reports, ii) A predictive model for estimating defectiveness of a given source code. These artifacts can be useful for building tools and techniques pertaining to several automated software engineering areas such as bug localization, code review, and recommendation and program repair. In order to achieve our goal, we first extract coding style information (e.g. related to programming language constructs used in the source code) for source code files present on GitHub. Then the information available in bug reports (if any) associated with these source code files are extracted. Thus fetched un(/ semi)-structured information is then transformed into a structured knowledge base. We considered more than 30400 source code files from 20 different GitHub repositories with about 14950 associated bug reports across 4 bug tracking portals. The source code files considered are written in four programming languages (viz., C, C++, Java, and Python) and belong to different types of applications. A machine learning (ML) model for estimating the defectiveness of a given input source code is then trained using the knowledge base. In order to pick the best ML model, we evaluated 8 different ML algorithms such as Random Forest, K Nearest Neighbour and SVM with around 50 parameter configurations to compare their performance on our tasks. One of our findings shows that best K-fold (with k=5) cross-validation results are obtained with the NuSVM technique that gives a mean F1 score of 0.914.

Motivation & Objective

  • To develop a predictive model for estimating defectiveness in source code using programming style features.
  • To create a structured knowledge base from unstructured GitHub source code and associated bug reports.
  • To investigate the correlation between programming style and software defectiveness.
  • To evaluate multiple machine learning algorithms on a large-scale, multi-language dataset for defect prediction.
  • To enable automated software engineering tasks such as bug localization, code review, and program repair.

Proposed method

  • Extracted programming style features (e.g., construct counts, identifier length, nesting depth) from source files across 20 GitHub repositories.
  • Collected and parsed bug reports from 4 bug tracking portals (Apache, Eclipse, etc.) to associate defect metadata with source files.
  • Transformed unstructured code and bug report data into a structured relational knowledge base to reduce bias and improve model training.
  • Trained 8 machine learning models (including Random Forest, SVM, KNN) with 50 hyperparameter configurations per model on the dataset.
  • Used 5-fold cross-validation to evaluate model performance, focusing on F1 score as the primary metric.
  • Selected the best-performing model (NuSVM) based on average F1 score across multiple evaluation scenarios.

Experimental results

Research questions

  • RQ1Is there a significant correlation between specific programming style features and the likelihood of defects in source code?
  • RQ2Can a machine learning model trained on GitHub source code and bug reports accurately predict whether a source file is defective?
  • RQ3Which machine learning algorithm performs best for defectiveness prediction across diverse programming languages and project types?
  • RQ4How do different feature representations (e.g., construct frequency, identifier length) contribute to defect prediction accuracy?
  • RQ5Can the model distinguish between files with high-priority defects and those with lower-priority or unspecified defects?

Key findings

  • The NuSVM model achieved the highest mean F1 score of 0.914 on 5-fold cross-validation, outperforming other models.
  • The model was trained on a large-scale dataset of 30,400 source files from 20 OSS repositories across 4 programming languages (C, C++, Java, Python).
  • The dataset included 14,950 associated bug reports from 4 major bug tracking portals (Apache, Eclipse, etc.).
  • SVM with radial kernel achieved an averaged F1 score of 0.807 for classifying files as potentially defective or not.
  • The Random Forest model with 7 estimators achieved an F1 score of 0.694 when predicting high-priority defects.
  • The study demonstrates that programming style features such as construct frequency, identifier length, and nesting depth are strong predictors of defectiveness.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.