[论文解读] Characterizing Bugs in Python and R Data Analytics Programs
本研究利用 5,068 篇 Stack Overflow 帖子和来自主要数据科学库的 1,800 个 GitHub 修复提交,对 Python 和 R 数据分析程序中的错误进行了特征分析。研究发现,逻辑错误(Logic Bugs)最为常见,其中 Python 更常出现数据预处理错误和参数配置错误,而 R 则更多涉及数据流错误和包变更相关问题。尽管在可比包之间存在较强的跨语言错误模式相关性,但两类语言在错误类型上仍存在差异。
R and Python are among the most popular languages used in many critical data analytics tasks. However, we still do not fully understand the capabilities of these two languages w.r.t. bugs encountered in data analytics tasks. What type of bugs are common? What are the main root causes? What is the relation between bugs and root causes? How to mitigate these bugs? We present a comprehensive study of 5,068 Stack Overflow posts, 1,800 bug fix commits from GitHub repositories, and several GitHub issues of the most used libraries to understand bugs in R and Python. Our key findings include: while both R and Python have bugs due to inexperience with data analysis, Python see significantly larger data preprocessing bugs compared to R. Developers experience significantly more data flow bugs in R because intermediate results are often implicit. We also found changes and bugs in packages and libraries cause more bugs in R compared to Python while package or library misselection and conflicts cause more bugs in Python than R. While R has a slightly higher readability barrier for data analysts, the statistical power of R leads to a less number of bad performance bugs. In terms of data visualization, R packages have significantly more bugs than Python libraries. We also identified a strong correlation between comparable packages in R and Python despite their linguistic and methodological differences. Lastly, we contribute a large dataset of manually verified R and Python bugs.
研究动机与目标
- 理解在 R 和 Python 中编写的数据显示分析程序中错误的频率、类型和根本原因。
- 研究错误类型、根本原因及其对程序执行持久影响之间的关系。
- 识别在可比 R 和 Python 数据分析包中错误模式的共性与差异。
- 为未来在自动化调试与修复方面的研究,提供一个大规模且经人工验证的 R 和 Python 错误数据集。
- 基于实证发现,为数据科学教育、开发工具和库设计提供最佳实践建议。
提出的方法
- 收集并分析了来自顶级 R 和 Python 数据分析库的 5,068 篇 Stack Overflow 帖子和 1,800 个 GitHub 修复提交。
- 选取了十一款标签最多的 R 包(如 ggplot2、dplyr、tidyr)和七款标签最多的 Python 包(如 Pandas、Scikit-learn、Matplotlib)进行分析。
- 人工将错误分类为类型(如逻辑错误、数据错误、数据流错误)、根本原因(如与数据分析混淆、参数错误)和影响(如性能问题、输出错误)。
- 利用经筛选的 GitHub 提交和 Stack Overflow 帖子数据集,识别错误频率、根本原因和修复复杂度的模式。
- 应用改进后的错误分类体系对错误及其影响进行分类,确保 R 和 Python 生态系统间的一致性。
- 对 R 和 Python 进行对比分析,以识别语言特异性趋势以及错误模式的跨语言相关性。
实验结果
研究问题
- RQ1RQ1:在 R 和 Python 的数据显示分析程序中,哪类错误最为频繁?
- RQ2RQ2:数据显示分析程序中错误的常见根本原因是什么?
- RQ3RQ3:错误类型、根本原因及其影响在显示分析任务中的关系如何?
- RQ4RQ4:错误在显示分析程序中会产生哪些持久性影响?
- RQ5RQ5:不同的数据显示分析库是否在错误类型上表现出共性?
主要发现
- 在 R 和 Python 中,逻辑错误(LB)是最常见的错误类型,分别在研究数据集中出现了 559 次和 1,210 次。
- 数据错误(DB)在 Python 中显著多于 R,分别有 1,210 次和 559 次,主要源于数据预处理错误。
- 数据流错误(DFB)在 R 中更为普遍(544 次),而 Python 中为 1,132 次,这主要归因于数据流水线中隐式的中间结果。
- 与数据分析混淆(CDA)是 R 和 Python 中错误的首要根本原因,其次是参数错误(IDAP)。
- 包/库变更(APIC)在 R 中引发的错误多于 Python,而包选择错误与冲突(PLMC)在 Python 中更为常见。
- 尽管在语言和方法论上存在差异,但在可比的 R 和 Python 包之间,错误类型和根本原因仍表现出强烈的关联性。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。