SOAR: A Synthesis Approach for Data Science API Refactoring

SOAR: A Synthesis Approach for Data Science API Refactoring
复制标题

DOI:
10.1109/icse43902.2021.00023
复制
发表时间:
2021-02
期刊:
2021 IEEE/ACM 43rd International Conference on Software Engineering (ICSE)
影响因子:
--
通讯作者:
Ansong Ni;Daniel Ramos;Aidan Z. H. Yang;I. Lynce;Vasco M. Manquinho;R. Martins;Claire Le Goues
Ansong Ni;Daniel Ramos;Aidan Z. H. Yang;I. Lynce;Vasco M. Manquinho;R. Martins;Claire Le Goues
中科院分区:
其他
文献类型:
--
作者:
Ansong Ni;Daniel Ramos;Aidan Z. H. Yang;I. Lynce;Vasco M. Manquinho;R. Martins;Claire Le Goues

文献摘要

相似文献

随着开源数据科学界的增长,数据科学库的数量和同一库的版本数量都在迅速增加。为了匹配这些库的不断发展的API,开源组织通常必须施加手动努力来重构代码库中使用的API。此外,由于大量的开源库,从事某个应用程序的数据科学家可能会有大量的库可供选择,维护和迁移。 API之间的手动重构是一项繁琐且容易出错的任务。尽管最近在不同语言之间进行自动API进行了重构的研究工作,但以前的工作依赖于统计学习,并收集了对API匹配和迁移的成对培训数据。使用大型统计数据进行重构不是理想的选择,因为此类培训数据将无法用于新的库或同一库的新版本。我们引入了开源API重构(SOAR)的合成,这是一种新型技术,不需要训练数据才能实现API迁移和重构。 SOAR仅依靠文档在库中很容易获得的文档来学习API表示并在库之间映射。使用程序合成,SOAR自动计算了对API的参数配置以及调用这些API所需的任何胶水代码。在运行重构代码时,SOAR还使用解释器的错误消息来生成可用于修剪搜索空间的逻辑约束。我们的经验评估表明,SOAR可以成功重构我们的80%的基准测试,该基准对应于深度学习模型,最多44层,平均运行时间为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.