上下文感知的数据整理代码生成:计算笔记本中的研究
Contextualized Data-Wrangling Code Generation in Computational Notebooks
AI总结:
针对计算笔记本中数据整理代码生成任务,提出CoCoMine自动挖掘上下文数据并构建CoCoNote数据集,以及DataCoder模型,实验证明其有效性。
摘要:
数据整理,即在计算笔记本中准备原始数据以供进一步分析的过程,是数据科学中一个关键但耗时的步骤。代码生成有潜力通过将用户意图转化为可执行代码来自动化数据整理过程,从而减少分析人员的工作负担。精确生成数据整理代码需要全面考虑笔记本中丰富的上下文,包括文本上下文、代码上下文和数据上下文。然而,笔记本经常将多个非线性分析任务交错排列成线性的代码块序列,其中上下文依赖关系并未清晰体现。直接使用源代码块训练模型无法充分利用这些上下文来生成准确的整理代码。为了弥合这一差距,我们旨在构建一个具有清晰且丰富上下文的高质量数据集,以帮助训练用于数据整理代码生成任务的模型。在这项工作中,我们首先提出了一种自动化方法CoCoMine,用于挖掘具有清晰多模态上下文依赖关系的数据整理代码生成示例。它首先采用数据流分析来识别包含数据整理代码的代码块。然后,CoCoMine通过追踪和重放笔记本提取上下文化的数据整理代码示例。利用CoCoMine,我们构建了CoCoNote,一个包含58,221个示例的数据集,用于笔记本中的上下文感知数据整理代码生成。为了展示我们数据集的有效性,我们微调了一系列预训练代码模型,并在我们的任务上提示各种大型语言模型。此外,我们还提出了DataCoder,它分别编码数据上下文和代码与文本上下文以增强代码生成。实验结果表明,在数据整理代码生成中纳入数据上下文的重要性以及我们模型的有效性。我们在url...发布代码和数据。
英文摘要:
Data wrangling, the process of preparing raw data for further analysis in computational notebooks, is a crucial yet time-consuming step in data science. Code generation has the potential to automate the data wrangling process to reduce analysts' overhead by translating user intents into executable code. Precisely generating data wrangling code necessitates a comprehensive consideration of the rich context present in notebooks, including textual context, code context and data context. However, notebooks often interleave multiple non-linear analysis tasks into linear sequence of code blocks, where the contextual dependencies are not clearly reflected. Directly training models with source code blocks fails to fully exploit the contexts for accurate wrangling code generation. To bridge the gap, we aim to construct a high quality datasets with clear and rich contexts to help training models for data wrangling code generation tasks. In this work, we first propose an automated approach, CoCoMine to mine data-wrangling code generation examples with clear multi-modal contextual dependency. It first adopts data flow analysis to identify the code blocks containing data wrangling codes. Then, CoCoMine extracts the contextualized datawrangling code examples through tracing and replaying notebooks. With CoCoMine, we construct CoCoNote, a dataset containing 58,221 examples for Contextualized Data-wrangling Code generation in Notebooks. To demonstrate the effectiveness of our dataset, we finetune a range of pretrained code models and prompt various large language models on our task. Furthermore, we also propose DataCoder, which encodes data context and code&textual contexts separately to enhance code generation. Experiment results demonstrate the significance of incorporating data context in data-wrangling code generation and the effectiveness of our model. We release code and data at url...
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。