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.
翻译:随着开放源数据科学群体的增长,数据科学图书馆的数量和同一图书馆的版本数量都在迅速增加。为了与这些图书馆不断演变的 API 匹配,开放源组织往往必须手工努力,重新构建代码库中使用的 API 。此外,由于类似的开放源码图书馆数量众多,在一个应用程序中工作的数据科学家可能拥有大量图书馆来选择、维持和迁移。在 API 之间人工重构是一个烦琐和容易出错的任务。虽然最近为在不同语言之间自动进行 API 重新定位做了一些研究,但以往的工作依赖于通过收集的对口培训数据来进行统计学习,以重新构建代码。使用大型统计数据来重新构建代码并不理想,因为新的图书馆或同一图书馆的新版本将无法提供这类培训数据。我们引入了 Opt-SPI Reformal Reformation(SOAR) 的合成合成,这种新技术不需要经过深层次的训练数据来实现 API 迁移和再定位。SOAR 运行的时间模型只能运行在SOAR AS AS AS 的直径解算法库中,这些直径解到SOADI AS AS 需要的自动解到SPI AS AS AS AS AS AS AS AS AS AS AS 平序号中,这些平序号的预解算法是用来使用。