[論文レビュー] Estimating defectiveness of source code: A predictive model using GitHub content
本稿では、GitHubリポジトリから抽出したプログラミングスタイル特徴量を用いて、ソースコードの欠陥の有無を推定する予測モデルを提案する。C、C++、Java、Pythonの4言語で構成される20のOSSプロジェクトから30,400件のソースファイルを収集し、14,950件のバグレポートと統合することで、NuSVMを用いた機械学習モデルを学習した。その結果、平均F1スコアが0.914に達し、コーディングスタイルのパターンに基づく欠陥予測において優れた性能を示した。
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.
研究の動機と目的
- プログラミングスタイル特徴量を用いて、ソースコードの欠陥の有無を推定する予測モデルの開発。
- 非構造的なGitHubのソースコードと関連バグレポートから、構造的な知識ベースの構築。
- プログラミングスタイルとソフトウェア欠陥の有無との相関関係の調査。
- 多言語・大規模データセットを用いた欠陥予測のための複数の機械学習アルゴリズムの評価。
- バグの局所化、コードレビュー、プログラム修復などの自動化されたソフトウェア工学タスクの支援。
提案手法
- 20のGitHubリポジトリのソースファイルから、構造物の数、識別子長、ネスティング深さなどのプログラミングスタイル特徴量を抽出した。
- Apache、Eclipseなど4つのバグトラッキングポータルからバグレポートを収集・解析し、バグメタデータをソースファイルに関連付けた。
- 非構造的なコードおよびバグレポートデータを、バイアスを低減し、モデル学習を効果的にするために、構造的なリレーショナル知識ベースに変換した。
- ランダムフォレスト、SVM、KNNを含む8種類の機械学習モデルを、各モデルに対して50通りのハイパーパrameter設定で、データセット上で学習させた。
- 5分割交差検証を用いてモデルの性能を評価し、主にF1スコアを評価指標とした。
- 複数の評価シナリオにおける平均F1スコアに基づき、最良の性能を示したモデル(NuSVM)を選定した。
実験結果
リサーチクエスチョン
- RQ1特定のプログラミングスタイル特徴量と、ソースコードにおける欠陥発生確率との間に有意な相関関係があるか?
- RQ2GitHubのソースコードとバグレポートを学習データとして用いた機械学習モデルは、特定のソースファイルが欠陥を有するかどうかを正確に予測できるか?
- RQ3多様なプログラミング言語やプロジェクトタイプにわたる欠陥予測において、どの機械学習アルゴリズムが最も優れた性能を示すか?
- RQ4構造物の頻度や識別子長などの異なる特徴量表現は、欠陥予測の正確性にどのように寄与するか?
- RQ5本モデルは、高優先度の欠陥を有するファイルと、低優先度または未指定の欠陥を有するファイルを区別できるか?
主な発見
- NuSVMモデルは、5分割交差検証において平均F1スコア0.914を達成し、他のモデルを上回った。
- モデルは、4つのプログラミング言語(C、C++、Java、Python)で構成される20のOSSリポジトリから得た30,400件のソースファイルという大規模データセット上で学習された。
- データセットには、4つの主要なバグトラッキングポータル(Apache、Eclipseなど)から得た14,950件の関連バグレポートが含まれていた。
- 径数カーネルを用いたSVMは、ファイルが潜在的に欠陥を有するかどうかを分類する際、平均F1スコア0.807を達成した。
- 7個の推定器を用いたランダムフォレストモデルは、高優先度欠陥を予測する際、F1スコア0.694を達成した。
- 本研究では、構造物の頻度、識別子長、ネスティング深さといったプログラミングスタイル特徴量が、欠陥の有無を強く予測する要因であることが示された。
この論文を読む
Nubintのビューアで原文を開き、読みながら気になる箇所をすぐに質問できます。
Nubintでこの論文を読むこのレビューはAIが論文の原文をもとに作成しました。引用する前に原文をご確認ください。