从代码变更到质量提升:基于PyQu的Python ML系统实证研究
From Code Changes to Quality Gains: An Empirical Study in Python ML Systems with PyQu
AI总结:
本文通过分析3340个开源Python ML项目,利用PyQu工具识别出61种提升软件质量的代码变更,揭示了代码变更与ML系统质量之间的关系,填补了现有研究的空白。
摘要:
在生成式人工智能推动代码生成和Python基于机器学习系统(MLS)日益普及的时代,软件质量已成为主要关注点。随着这些系统复杂性和重要性增加,理解特定代码变更如何影响整体质量成为关键障碍,这受到缺乏质量评估工具和ML系统代码变更与质量影响之间明确映射的限制。尽管先前研究探讨了MLS中的代码变更,但大多止步于变更本身,未能揭示代码变更与MLS质量之间的关系。为解决这一缺口,我们对3340个开源Python ML项目进行了大规模实证研究,涵盖超过3700万个提交和2700万亿行代码。我们引入PyQu,一种利用低级软件度量来识别质量提升提交的工具,其平均准确率、精确率和召回率均为0.84,平均F1得分为0.85。通过PyQu和主题分析,我们识别出61种代码变更,每种均对提升软件质量有直接影响,并根据上下文特征将其分为13类。41%的变更是本研究新发现的,未被最先进的Python变更检测工具识别。本研究为研究人员、实践者、教育者和工具开发者提供了重要基础,推动了自动化质量评估和Python基于ML软件最佳实践的探索。
英文摘要:
In an era shaped by Generative Artificial Intelligence for code generation and the rising adoption of Python-based Machine Learning systems (MLS), software quality has emerged as a major concern. As these systems grow in complexity and importance, a key obstacle lies in understanding exactly how specific code changes affect overall quality-a shortfall aggravated by the lack of quality assessment tools and a clear mapping between ML systems code changes and their quality effects. Although prior work has explored code changes in MLS, it mostly stops at what the changes are, leaving a gap in our knowledge of the relationship between code changes and the MLS quality. To address this gap, we conducted a large-scale empirical study of 3,340 open-source Python ML projects, encompassing more than 3.7 million commits and 2.7 trillion lines of code. We introduce PyQu, a novel tool that leverages low level software metrics to identify quality-enhancing commits with an average accuracy, precision, and recall of 0.84 and 0.85 of average F1 score. Using PyQu and a thematic analysis, we identified 61 code changes, each demonstrating a direct impact on enhancing software quality, and we classified them into 13 categories based on contextual characteristics. 41% of the changes are newly discovered by our study and have not been identified by state-of-the-art Python changes detection tools. Our work offers a vital foundation for researchers, practitioners, educators, and tool developers, advancing the quest for automated quality assessment and best practices in Python-based ML software.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。