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

为什么机器学习笔记本会崩溃?公共Python编译器笔记本的实证研究

Why do Machine Learning Notebooks Crash? An Empirical Study on Public Python Jupyter Notebooks

Yiran Wang, Willem Meijer, José Antonio Hernández López, Ulf Nilsson, Dániel Varró

摘要:

60 yter笔记本已经成为数据科学的核心,在灵活的环境中集成代码,文本和输出。随着机器学习(ML)的兴起,笔记本电脑越来越多地用于原型设计和数据分析。然而,由于它们依赖于复杂的机器学习库和灵活的笔记本语义,允许单元以任何顺序运行,笔记本容易受到软件错误的影响,这些错误可能导致程序崩溃。本文提出了一项全面的实证研究,重点关注公开可用的Python ML笔记本中的崩溃。我们从GitHub和Kaggle收集了64,031个笔记本,其中包含92,542个崩溃,并手动分析了746个崩溃样本的各个方面,包括崩溃类型和根本原因。我们的分析确定了独特的ML特定崩溃类型,例如违反API约束的张量形状不匹配和数据集值错误。此外,我们强调了与笔记本语义相关的独特根本原因,包括乱序执行和以前单元格的残留错误,这些在以前的研究中基本上被忽视了。此外,我们还确定了最容易出错的ML库,并分析了ML管道阶段的崩溃分布。我们发现,超过40%的崩溃源于API滥用和笔记本特定的问题。在使用TensorFlow/Keras和Torch等ML库时经常发生崩溃。此外,超过70%的崩溃发生在ML管道的数据准备、模型训练和评估或预测阶段,而数据可视化错误往往是ML笔记本所独有的。

英文摘要:

Jupyter notebooks have become central in data science, integrating code, text and output in a flexible environment. With the rise of machine learning (ML), notebooks are increasingly used for prototyping and data analysis. However, due to their dependence on complex ML libraries and the flexible notebook semantics that allow cells to be run in any order, notebooks are susceptible to software bugs that may lead to program crashes. This paper presents a comprehensive empirical study focusing on crashes in publicly available Python ML notebooks. We collect 64,031 notebooks containing 92,542 crashes from GitHub and Kaggle, and manually analyze a sample of 746 crashes across various aspects, including crash types and root causes. Our analysis identifies unique ML-specific crash types, such as tensor shape mismatches and dataset value errors that violate API constraints. Additionally, we highlight unique root causes tied to notebook semantics, including out-of-order execution and residual errors from previous cells, which have been largely overlooked in prior research. Furthermore, we identify the most error-prone ML libraries, and analyze crash distribution across ML pipeline stages. We find that over 40% of crashes stem from API misuse and notebook-specific issues. Crashes frequently occur when using ML libraries like TensorFlow/Keras and Torch. Additionally, over 70% of the crashes occur during data preparation, model training, and evaluation or prediction stages of the ML pipeline, while data visualization errors tend to be unique to ML notebooks.

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

↑