一句话:无需训练数据,利用库文档与程序合成自动重构数据科学 API,并用解释器错误信息剪枝搜索空间。
开源数据科学库及其版本快速增加,开发者常需手动迁移 API,耗时且易错。已有自动 API 重构依赖成对训练数据的统计学习,但新库或新版本往往缺乏此类数据。SOAR 无需训练数据,仅利用库发布时已有的文档学习 API 表示与库间映射,并用程序合成自动推断 API 参数配置和所需胶水代码;它还用运行重构代码时的解释器错误信息生成逻辑约束以剪枝搜索空间。评估显示,SOAR 对深度学习模型基准(最多 44 层)重构成功率为 80%,平均耗时 97.23 秒;对数据整理基准成功率为 90%,平均耗时 17.31 秒。
With the growth of the open-source data science community, both the number of data science libraries and the number of versions for the same library are increasing rapidly. To match the evolving APIs from those libraries, open-source organizations often have to exert manual effort to refactor the APIs used in the code base. Moreover, due to the abundance of similar open-source libraries, data scientists working on a certain application may have an abundance of libraries to choose, maintain and migrate between. The manual refactoring between APIs is a tedious and error-prone task. Although recent research efforts were made on performing automatic API refactoring between different languages, previous work relies on statistical learning with collected pairwise training data for the API matching and migration. Using large statistical data for refactoring is not ideal because such training data will not be available for a new library or a new version of the same library. We introduce Synthesis for Open-Source API Refactoring (SOAR), a novel technique that requires no training data to achieve API migration and refactoring. SOAR relies only on the documentation that is readily available at the release of the library to learn API representations and mapping between libraries. Using program synthesis, SOAR automatically computes the correct configuration of arguments to the APIs and any glue code required to invoke those APIs. SOAR also uses the interpreter's error messages when running refactored code to generate logical constraints that can be used to prune the search space. Our empirical evaluation shows that SOAR can successfully refactor 80% of our benchmarks corresponding to deep learning models with up to 44 layers with an average run time of 97.23 seconds, and 90% of the data wrangling benchmarks with an average run time of 17.31 seconds.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@inproceedings{NiRYLMMG21,
title = {SOAR: A Synthesis Approach for Data Science API Refactoring},
author = {Ansong Ni and Daniel Ramos and Aidan Z. H. Yang and Inês Lynce and Vasco Manquinho and Ruben Martins and Claire Le Goues},
booktitle = {ICSE},
year = {2021},
doi = {10.1109/icse43902.2021.00023}
}