Developers often need to decide which APIs to use for the functions being implemented. With the ever-growing number of APIs and libraries, it becomes increasingly difficult for developers to find appropriate APIs, indicating the necessity of automatic API usage recommendation. Previous studies adopt statistical models or collaborative filtering methods to mine the implicit API usage patterns for recommendation. However, they rely on the occurrence frequencies of APIs for mining usage patterns, thus prone to fail for the low-frequency APIs. Besides, prior studies generally regard the API call interaction graph as homogeneous graph, ignoring the rich information (e.g., edge types) in the structure graph. In this work, we propose a novel method named MEGA for improving the recommendation accuracy especially for the low-frequency APIs. Specifically, besides call interaction graph, MEGA considers another two new heterogeneous graphs: global API co-occurrence graph enriched with the API frequency information and hierarchical structure graph enriched with the project component information. With the three multi-view heterogeneous graphs, MEGA can capture the API usage patterns more accurately. Experiments on three Java benchmark datasets demonstrate that MEGA significantly outperforms the baseline models by at least 19% with respect to the Success Rate@1 metric. Especially, for the low-frequency APIs, MEGA also increases the baselines by at least 55% regarding the Success Rate@1.
翻译:开发者往往需要决定要使用哪些 API 。 随着越来越多的 API 和 图书馆, 开发者越来越难以找到合适的 API, 这表明自动 API 使用建议的必要性。 以前的研究采用统计模型或合作过滤方法来清除隐含 API 使用模式的建议。 但是, 开发者依靠API 的发生频率来决定采矿使用模式, 因而低频 API 的信息可能会失败。 此外, 先前的研究通常将 API 调用互动图视为同质图形, 忽略结构图中的丰富信息( 例如, 边缘类型 ) 。 在这项工作中, 我们提出了一个名为MEGA的新方法, 以提高建议准确性, 特别是低频 API 使用模式。 具体地说, MEGA 考虑另外两个新的混合图表: API 与 相丰富 的 API 频率信息和 结构图, 与项目组件 相丰富 的等级 图表。 三个多视图 组合图, MEGA 能够更准确地捕捉取 API 使用模式( 如 边缘 ) ) 。 在三个 NAPI 基准 基准 基准 上, 在 最低 基准 标准 1 上, 通过 MAGA 以 19A 标准 标准 向 向 向 向 级 标准 向 级 向 向 向 标 标 标 标 标 显示 标 向 向 标 标 标 。