Skip to main content
QUICK REVIEW

[論文レビュー] Early Prediction for Merged vs Abandoned Code Changes in Modern Code Reviews

Md. Khairul Islam, Toufique Ahmed|arXiv (Cornell University)|Dec 6, 2019
Software Engineering Research参考文献 59被引用数 22
ひとこと要約

本稿では、現代のコードレビューにおいて、コード変更が早期にマージされるか放棄されるかを予測するLightGBMベースの機械学習モデルPredCRを提案する。3つのオープンソースプロジェクトから得た146,612件のコード変更を、レビュアー、著者、プロジェクト、テキスト、コードの5つの次元から抽出した25の特徴量を用いて学習したPredCRは、平均AUCが85%に達し、先行研究より14–23%の相対的性能向上を達成するとともに、新規貢献者に対するバイアスを低減した。

ABSTRACT

The modern code review process is an integral part of the current software development practice. Considerable effort is given here to inspect code changes, find defects, suggest an improvement, and address the suggestions of the reviewers. In a code review process, usually, several iterations take place where an author submits code changes and a reviewer gives feedback until is happy to accept the change. In around 12% cases, the changes are abandoned, eventually wasting all the efforts. In this research, our objective is to design a tool that can predict whether a code change would be merged or abandoned at an early stage to reduce the waste of efforts of all stakeholders (e.g., program author, reviewer, project management, etc.) involved. The real-world demand for such a tool was formally identified by a study by Fan et al. [1]. We have mined 146,612 code changes from the code reviews of three large and popular open-source software and trained and tested a suite of supervised machine learning classifiers, both shallow and deep learning based. We consider a total of 25 features in each code change during the training and testing of the models. The best performing model named PredCR (Predicting Code Review), a LightGBM-based classifier achieves around 85% AUC score on average and relatively improves the state-of-the-art [1] by 14-23%. In our empirical study on the 146,612 code changes from the three software projects, we find that (1) The new features like reviewer dimensions that are introduced in PredCR are the most informative. (2) Compared to the baseline, PredCR is more effective towards reducing bias against new developers. (3) PredCR uses historical data in the code review repository and as such the performance of PredCR improves as a software system evolves with new and more data.

研究の動機と目的

  • コードレビューにおける無駄な作業を削減する。特に、複数回の反復を経て放棄されるコード変更が約12%にのぼる現状を改善する。
  • 完全なレビュー期間が終了する前までに、マージされると予想されるか、放棄されると予想されるコード変更を早期に特定するツールを開発する。
  • 先行研究の限界、すなわち予測タイミングが遅いこと、歴史的文脈が欠落していること、新規貢献者に対するバイアスがあることに対処する。
  • レビュアー、著者、プロジェクト、テキスト、コードの特徴量を統合的に組み込んだモデルを用いて、予測精度を向上させる。

提案手法

  • 著者らは、Eclipse、LibreOffice、GerritHubの3つの大規模オープンソースプロジェクトにおけるGerritベースのコードレビューから、146,612件のコード変更を収集した。
  • レビュアー(例:レビュアーの経験年数、過去のレビュー数)、著者(例:貢献履歴)、プロジェクト(例:プロジェクトの規模、レビュー頻度)、テキスト(例:パッチメッセージの長さ、感情分析)、コード(例:変更された行数、複雑度)の5つの次元から、合計25の特徴量を抽出した。
  • 6つの分類器(ロジスティック回帰、SVM、ランダムフォレスト、XGBoost、LightGBM、および1つの深層ニューラルネットワーク)を用いた教師あり学習手法を適用した。
  • データ漏洩を防ぎ、現実的な早期予測シナリオを再現するため、縦断的クロスバリデーションを用いてモデルを学習および評価した。
  • クラス不均衡に対処するため、バランスの取れた分類損失関数を採用し、ハイパーパrameterチューニングにより性能最適化を実施した。
  • PredCRは、AUCおよびその他の指標を基準に、LightGBMベースのモデルとして最も優れた性能を示した。

実験結果

リサーチクエスチョン

  • RQ1PredCRは、最先端のベースライン(Fan et al. [1])を上回る性能を示すか?
  • RQ2レビュアー、著者、プロジェクト、テキスト、コードの各特徴量次元は、コード変更の結果予測にどの程度有効か?
  • RQ3貢献履歴が限られた新規開発者に対するバイアスを、PredCRはどの程度低減できるか?
  • RQ4時間の経過とともに、より多くの歴史的データが蓄積されるにつれて、モデルの性能はどのように変化するか?
  • RQ5訓練データが限られた新しいプロジェクトやサブプロジェクトに適用した場合、PredCRの頑健性はどの程度保たれるか?

主な発見

  • PredCRは平均AUCスコア85%を達成し、最先端のベースライン(Fan et al. [1])に対して14–23%の相対的性能向上を示した。
  • レビュアー次元の特徴量が最も情報量が多く、予測性能に顕著な寄与を示した。続くのは著者、プロジェクト、コード、テキストの特徴量であった。
  • PredCRは、著者履歴が限られた状況でも、ベースラインと比較して新規開発者に対するバイアスを低減した。
  • より多くの歴史的データが蓄積されるにつれてモデルの性能が向上したため、PredCRは進化するコードレビューのリポジトリから利益を得られると示された。
  • 1つのプロジェクトで再学習した後、他のプロジェクトに適用しても強い性能を維持したため、PredCRはプロジェクト間で高い汎化性と移行性を示した。
  • リビジョンごとに予測を更新してもモデルの有効性が保たれたため、動的で変化し続けるレビューワークフローに対しても頑健であることが示された。

より良い研究を、今すぐ始めましょう

論文設計から論文執筆まで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。