Optional type annotations allow for enriching dynamic programming languages with static typing features like better Integrated Development Environment (IDE) support, more precise program analysis, and early detection and prevention of type-related runtime errors. Machine learning-based type inference promises interesting results for automating this task. However, the practical usage of such systems depends on their ability to generalize across different domains, as they are often applied outside their training domain. In this work, we investigate Type4Py as a representative of state-of-the-art deep learning-based type inference systems, by conducting extensive cross-domain experiments. Thereby, we address the following problems: class imbalances, out-of-vocabulary words, dataset shifts, and unknown classes. To perform such experiments, we use the datasets ManyTypes4Py and CrossDomainTypes4Py. The latter we introduce in this paper. Our dataset enables the evaluation of type inference systems in different domains of software projects and has over 1,000,000 type annotations mined on the platforms GitHub and Libraries. It consists of data from the two domains web development and scientific calculation. Through our experiments, we detect that the shifts in the dataset and the long-tailed distribution with many rare and unknown data types decrease the performance of the deep learning-based type inference system drastically. In this context, we test unsupervised domain adaptation methods and fine-tuning to overcome these issues. Moreover, we investigate the impact of out-of-vocabulary words.
翻译:选择类型说明可以丰富动态编程语言,使其具有静态打字功能,如更好的综合开发环境(IDE)支持、更精确的程序分析,以及早期发现和预防与类型相关的运行错误。机器学习型推论为这项任务的自动化带来了有趣的结果。然而,这些系统的实际使用取决于它们是否有能力在不同的领域加以推广,因为这些系统往往在培训领域之外应用。在这项工作中,我们调查4Py,作为最先进的深层次学习型推理系统的代表,通过进行广泛的跨度实验。因此,我们处理以下问题:阶级不平衡、校外词汇、数据集变化和未知的类别。为了进行这种实验,我们使用数据集的多功能4Py和CrosmamainType4Py。我们在此文件中介绍。我们的数据集能够评估不同软件项目领域的类型推理系统,并在GitHub和图书馆的平台上收集了1 000 000多种类型的图解。我们从两个域域的网络发展和科学领域变换数据,我们从这些细的系统到深层次的模型,我们从深度的变变的模型中,我们用这些模型来测量和深层次的数据类型,我们用来测量和深层次的模型的模型的模型的模型的模型的模型,我们去。