Data Scientists often use notebooks to develop Data Science (DS) pipelines, particularly since they allow to selectively execute parts of the pipeline. However, notebooks for DS have many well-known flaws. We focus on the following ones in this paper: (1) Notebooks can become littered with code cells that are not part of the main DS pipeline but exist solely to make decisions (e.g. listing the columns of a tabular dataset). (2) While users are allowed to execute cells in any order, not every ordering is correct, because a cell can depend on declarations from other cells. (3) After making changes to a cell, this cell and all cells that depend on changed declarations must be rerun. (4) Changes to external values necessitate partial re-execution of the notebook. (5) Since cells are the smallest unit of execution, code that is unaffected by changes, can inadvertently be re-executed. To solve these issues, we propose to replace cells as the basis for the selective execution of DS pipelines. Instead, we suggest populating a context-menu for variables with actions fitting their type (like listing columns if the variable is a tabular dataset). These actions are executed based on a data-flow analysis to ensure dependencies between variables are respected and results are updated properly after changes. Our solution separates pipeline code from decision making code and automates dependency management, thus reducing clutter and the risk of making errors.
翻译:数据科学家常使用笔记本开发数据科学管道,因其允许选择性执行管道的部分内容。然而用于数据科学的笔记本存在诸多公认缺陷。本文重点关注以下问题:(1) 笔记本可能充斥着不属于主数据科学管道、仅用于决策的代码单元(例如列出表格数据集的列名)。(2) 虽然用户可按任意顺序执行单元,但并非所有顺序都正确,因为单元可能依赖其他单元的声明。(3) 修改某单元后,该单元及所有依赖修改后声明的单元必须重新执行。(4) 外部值的变化需要笔记本的部分重新执行。(5) 由于单元是最小执行单位,不受变更影响的代码可能被意外重新执行。为解决这些问题,我们提出用替代方案取代单元作为数据科学管道选择性执行的基础。具体而言,建议在变量上下文菜单中填充适配其类型的操作(如对表格数据集变量执行"列出列名"操作)。这些操作基于数据流分析执行,确保尊重变量间的依赖关系,并在变更后正确更新结果。本方案将管道代码与决策代码分离,并自动化依赖管理,从而减少混乱和出错风险。