一句话:提出 Cell2Doc 机器学习流水线与基准数据集,按逻辑上下文为 notebook 代码单元生成文档。
计算笔记本本应结合代码与文档,但现有实践表明开发者常因手工成本而忽略文档。已有自动文档生成方法难以捕获算法细节和子步骤,开发者仍需编辑生成文本。本文提出 Cell2Doc,一种用于 Python 数据科学笔记本代码单元文档生成的机器学习流水线。该方法识别代码单元内不同逻辑上下文,分别生成文档再合并为整个代码单元的文档;它利用预训练语言模型并提升其在该任务上的效率,同时研究合适的输入表示。作者还发布了新的基准数据集及可复用的数据预处理流水线。自动评估表明,最佳输入表示使预训练模型性能平均提升 2.5 倍;人工评估中,Cell2Doc 在正确性、信息量和可读性上相较对应的独立预训练模型提升 1.33 倍。
Computational notebooks have become the go-to way for solving data-science problems. While they are designed to combine code and documentation, prior work shows that documentation is largely ignored by the developers because of the manual effort. Automated documentation generation can help, but existing techniques fail to capture algorithmic details and developers often end up editing the generated text to provide more explanation and sub-steps. This paper proposes a novel machine-learning pipeline, Cell2Doc, for code cell documentation in Python data science notebooks. Our approach works by identifying different logical contexts within a code cell, generating documentation for them separately, and finally combining them to arrive at the documentation for the entire code cell. Cell2Doc takes advantage of the capabilities of existing pre-trained language models and improves their efficiency for code cell documentation. We also provide a new benchmark dataset for this task, along with a data-preprocessing pipeline that can be used to create new datasets. We also investigate an appropriate input representation for this task. Our automated evaluation suggests that our best input representation improves the pre-trained model's performance by 2.5x on average. Further, Cell2Doc achieves 1.33x improvement during human evaluation in terms of correctness, informativeness, and readability against the corresponding standalone pretrained model.
@inproceedings{MondalBLV23,
title = {Cell2Doc: ML Pipeline for Generating Documentation in Computational Notebooks},
author = {Tamal Mondal and Scott Barnett and Akash Lal and Jyothi Vedurada},
booktitle = {ASE},
year = {2023},
doi = {10.1109/ase56229.2023.00200}
}