Skip to main content
QUICK REVIEW

[论文解读] CORAL: COde RepresentAtion Learning with Weakly-Supervised Transformers for Analyzing Data Analysis

Ge Zhang, Mike A. Merrill|arXiv (Cornell University)|Aug 28, 2020
Software Engineering Research被引用 4
一句话总结

CORAL 提出了一种基于注意力机制的弱监督 Transformer 模型,通过联合编码来自抽象语法树的代码和周围的自然语言注释,将 Jupyter Notebook 单元分类为数据分析阶段(例如,导入、清洗、探索、建模、评估)。该方法在专家启发式方法的基础上实现了 38% 的准确率提升,并实现了对 11.8 万个笔记本的大规模分析,揭示了笔记本结构与论文引用影响力的关联。

ABSTRACT

Large scale analysis of source code, and in particular scientific source code, holds the promise of better understanding the data science process, identifying analytical best practices, and providing insights to the builders of scientific toolkits. However, large corpora have remained unanalyzed in depth, as descriptive labels are absent and require expert domain knowledge to generate. We propose a novel weakly supervised transformer-based architecture for computing joint representations of code from both abstract syntax trees and surrounding natural language comments. We then evaluate the model on a new classification task for labeling computational notebook cells as stages in the data analysis process from data import to wrangling, exploration, modeling, and evaluation. We show that our model, leveraging only easily-available weak supervision, achieves a 38% increase in accuracy over expert-supplied heuristics and outperforms a suite of baselines. Our model enables us to examine a set of 118,000 Jupyter Notebooks to uncover common data analysis patterns. Focusing on notebooks with relationships to academic articles, we conduct the largest ever study of scientific code and find that notebook composition correlates with the citation count of corresponding papers.

研究动机与目标

  • 实现无需昂贵专家标注的科学代码大规模、深入分析。
  • 开发一种仅依赖简单启发式规则的弱监督模型,将代码片段分类为数据分析流水线的各个阶段。
  • 在数百万个 Jupyter 笔记本中发现科学数据分析的模式,并将其与论文引用影响力相关联。
  • 创建一个公开可获取的 1,840 个标注笔记本单元的数据集,用于代码阶段分类的评估。

提出的方法

  • CORAL 使用一种新颖的掩码注意力机制,联合建模来自抽象语法规则树的结构化代码和自然语言注释。
  • 采用基于五种简单启发式规则的弱监督训练目标,以替代昂贵的人工标注。
  • 在多任务优化框架中结合弱监督与无监督主题建模,以提升表征学习效果。
  • 利用预训练的 Transformer 架构,学习代码与注释的联合表征,用于阶段分类。
  • 引入图神经网络组件处理代码结构,将语法树信息与上下文注释相结合。
  • 在新构建的 1,840 个专家标注的笔记本单元数据集上进行微调,该数据集仅用于评估。

实验结果

研究问题

  • RQ1科学笔记本在其数据分析工作流中是否遵循一致的顺序模式?
  • RQ2笔记本中代码阶段的分布如何与相关学术论文的引用影响力相关?
  • RQ3仅通过简单启发式规则的弱监督,能否实现无需专家标注的高精度代码阶段分类?
  • RQ4不同领域中,笔记本内容与论文引用影响力的相关性是否存在差异?

主要发现

  • CORAL 在将代码分类为数据分析阶段的任务中,相比专家提供的启发式方法,准确率提升了 38%。
  • 与学术论文相关联的笔记本,其平均引用次数是未关联笔记本的 21.88 倍。
  • 阶段分布熵(阶段分布均匀性)每提高一个标准差,预期引用次数将增加 2.11 倍。
  • 在计算机科学和数学领域,数据清洗代码比例越高,论文引用数量越低;而在生物科学领域,这种效应不显著。
  • 探索阶段代码量较高的笔记本,其引用次数平均减少 35%,表明此类笔记本可能反映不完整或探索性的工作。
  • 该模型实现了对 11.8 万个 Jupyter 笔记本的大规模分析,揭示了大多数代码单元会过渡到不同阶段,表明数据分析过程具有动态、非线性的特征。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。