arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.06572cs.SE
收藏

检测机器学习 Python 项目中的重构提交:一种基于机器学习的方法

Detecting Refactoring Commits in Machine Learning Python Projects: A Machine Learning-Based Approach

Shayan Noei, Heng Li, Ying Zou

AI总结:

本文提出 MLRefScanner,利用机器学习检测 Python ML 项目中的通用与 ML 特有重构提交,在 199 个项目上显著优于现有工具。

摘要:

重构在不改变软件功能行为的情况下提升软件质量。理解开发者的重构活动对于提高软件可维护性至关重要。随着机器学习(ML)库和框架的使用日益增加,最大限度提升其可维护性变得至关重要。由于 ML 项目具有数据驱动特性,它们通常会经历不同的重构操作(例如数据处理),而现有重构工具缺乏针对 ML 的检测能力。此外,大量 ML 库使用 Python 编写,而 Python 的重构检测工具较为有限。PyRef 是一款基于规则且处于先进水平的 Python 重构检测工具,能够识别 11 种重构操作。相比之下,Rminer 可以检测 Java 项目中的 99 种重构类型。我们提出了 MLRefScanner,这是一款应用机器学习技术检测 ML Python 项目中重构提交的原型工具。MLRefScanner 可识别同时包含 ML 特有重构操作和通用重构操作的提交。在 199 个 ML 项目上对 MLRefScanner 进行评估表明,与先进方法相比,其性能更优,总体达到 94% 的精确率和 82% 的召回率。将其与 PyRef 结合后,性能进一步提升至 95% 的精确率和 99% 的召回率。本研究凸显了 ML 驱动方法在跨不同编程语言和技术领域检测重构方面的潜力,可解决基于规则的检测方法的局限性。

英文摘要:

Refactoring enhances software quality without altering its functional behaviors. Understanding the refactoring activities of developers is crucial to improving software maintainability. With the increasing use of machine learning (ML) libraries and frameworks, maximizing their maintainability is crucial. Due to the data-driven nature of ML projects, they often undergo different refactoring operations (e.g., data manipulation), for which existing refactoring tools lack ML-specific detection capabilities. Furthermore, a large number of ML libraries are written in Python, which has limited tools for refactoring detection. PyRef, a rule-based and state-of-the-art tool for Python refactoring detection, can identify 11 types of refactoring operations. In comparison, Rminer can detect 99 types of refactoring for Java projects. We introduce MLRefScanner, a prototype tool that applies machine-learning techniques to detect refactoring commits in ML Python projects. MLRefScanner identifies commits with both ML-specific and general refactoring operations. Evaluating MLRefScanner on 199 ML projects demonstrates its superior performance compared to state-of-the-art approaches, achieving an overall 94% precision and 82% recall. Combining it with PyRef further boosts performance to 95% precision and 99% recall. Our study highlights the potential of ML-driven approaches in detecting refactoring across diverse programming languages and technical domains, addressing the limitations of rule-based detection methods.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑