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 the generalization ability of Type4Py as a representative for state-of-the-art deep learning-based type inference systems, by conducting extensive cross-domain experiments. Thereby, we address the following problems: dataset shifts, out-of-vocabulary words, unknown classes, and rare classes. To perform such experiments, we use the datasets ManyTypes4Py and CrossDomainTypes4Py. The latter we introduce in this paper. Our dataset has over 1,000,000 type annotations and enables cross-domain evaluation of type inference systems in different domains of software projects using data from the two domains web development and scientific calculation. Through our experiments, we detect shifts in the dataset and that it has a long-tailed distribution with many rare and unknown data types which decreases 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 the issues. Moreover, we investigate the impact of out-of-vocabulary words.
翻译:选择类型说明可以丰富动态编程语言,使其具有静态打字功能,例如更好的综合开发环境(IDE)支持,更精确的程序分析,以及早期发现和预防类型相关运行时间错误。机器学习型推论为这项任务的自动化带来了有趣的结果。然而,这些系统的实际使用取决于它们是否有能力在不同的领域加以推广,因为这些系统往往在培训领域之外应用。在这项工作中,我们调查4Py作为最先进的深层次学习型推论系统的代表的通用能力,通过进行广泛的跨行实验,从而能够对不同领域的软件项目进行跨行实验。因此,我们解决了以下问题:数据集变化、词汇外的字、未知的班级和稀有的班级。为了进行这种实验,我们使用许多数据集在培训领域加以推广,我们用许多基于精细网络开发和科学计算的数据进行深层次推导式推导。我们通过进行这样的实验,在深度推导模型中,我们通过对数据类型进行长期的变换,在深度推导学中,我们用不甚为深的精确的精确的推导方法,我们用在深度推算中,在深度推算中发现数据类型中,在深度的深度推磨中,我们用了很多的推磨中,在深度推磨中,在深度推磨中,我们用了很多的数据类型中,我们用在深度的推磨中,我们用在深度推磨中,在深度推磨中,我们用了很多数据类型中,在深度的推磨中,我们用了很多数据类型中,在深度推。