arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2209.03507cs.SE
收藏

在如此之少:创建Python库的轻量级嵌入

So Much in So Little: Creating Lightweight Embeddings of Python Libraries

Yaroslav Golubev, Egor Bogomolov, Egor Bulychev, Timofey Bryksin

摘要:

在软件工程中,不同的方法和机器学习模型利用不同类型的数据:源代码、文本信息、历史数据。任何项目的一个重要组成部分是它的依赖关系。依赖项列表相对较小,但带有大量语义,可用于比较项目或对其进行判断。在本文中,我们重点关注Python项目及其以requirements.txt文件形式存在的PyPi依赖项。我们编译了一个包含7,132个Python项目及其依赖关系的数据集,并使用Git从前几年中提取它们的版本。使用这些数据,我们通过将奇异值分解应用于项目和库的共生矩阵来构建32维的库嵌入。然后,我们聚类的嵌入和研究它们的语义关系。为了展示这种轻量级库嵌入的有用性,我们介绍了一个原型工具,用于向给定项目建议相关库。该工具计算项目嵌入,并使用具有类似嵌入的项目的依赖关系来形成建议。为了比较不同的库编译器,我们基于开源项目中依赖集的演变创建了一个基准。基于创建的嵌入的方法显著优于显示给定年份中最受欢迎的库的基线。我们还进行了一项用户研究,结果表明,不同项目领域的建议质量不同,即使是相关的建议也可能不是特别有用。最后,为了促进潜在的更有用的推荐,我们扩展了推荐系统,提供了一个推荐稀有库的选项。

英文摘要:

In software engineering, different approaches and machine learning models leverage different types of data: source code, textual information, historical data. An important part of any project is its dependencies. The list of dependencies is relatively small but carries a lot of semantics with it, which can be used to compare projects or make judgements about them. In this paper, we focus on Python projects and their PyPi dependencies in the form of requirements.txt files. We compile a dataset of 7,132 Python projects and their dependencies, as well as use Git to pull their versions from previous years. Using this data, we build 32-dimensional embeddings of libraries by applying Singular Value Decomposition to the co-occurrence matrix of projects and libraries. We then cluster the embeddings and study their semantic relations. To showcase the usefulness of such lightweight library embeddings, we introduce a prototype tool for suggesting relevant libraries to a given project. The tool computes project embeddings and uses dependencies of projects with similar embeddings to form suggestions. To compare different library recommenders, we have created a benchmark based on the evolution of dependency sets in open-source projects. Approaches based on the created embeddings significantly outperform the baseline of showing the most popular libraries in a given year. We have also conducted a user study that showed that the suggestions differ in quality for different project domains and that even relevant suggestions might be not particularly useful. Finally, to facilitate potentially more useful recommendations, we extended the recommender system with an option to suggest rarer libraries.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑