Type4Py: Practical Deep Similarity Learning-Based Type Inference for Python
Tue 10 May 2022 21:20 - 21:25 at ICSE room 3-odd hours - Machine Learning with and for SE 6 Chair(s): Ali Ouni
Dynamic languages, such as Python and Javascript, trade static typing for developer flexibility and productivity. Lack of static typing can cause run-time exceptions and is a major factor for weak IDE support. To alleviate these issues, PEP 484 introduced optional type annotations for Python. As retrofitting types to existing codebases is error-prone and laborious, machine learning (ML)-based approaches have been proposed to enable automatic type inference based on existing, partially annotated codebases. However, previous ML-based approaches are trained and evaluated on human-provided type annotations, which might not always be sound, and hence this may limit the practicality for real-world usage. In this paper, we present Type4Py, a deep similarity learning-based hierarchical neural network model. It learns to discriminate between similar and dissimilar types in a high-dimensional space, which results in clusters of types. Likely types for arguments, variables, and return values can then be inferred through the nearest neighbor search. Unlike previous work, we trained and evaluated our model on a \emph{type-checked} dataset and used mean reciprocal rank (MRR) to reflect the performance perceived by users. The obtained results show that Type4Py achieves an MRR of 77.1%, which is a substantial improvement of 8.1% and 16.7% over the state-of-the-art approaches Typilus and TypeWriter, respectively. Finally, to aid developers with retrofitting types, we released a Visual Studio Code extension, which uses Type4Py to provide ML-based type auto-completion for Python.
Tue 10 MayDisplayed time zone: Eastern Time (US & Canada) change
21:00 - 22:00 | Machine Learning with and for SE 6Technical Track at ICSE room 3-odd hours Chair(s): Ali Ouni ETS Montreal, University of Quebec | ||
21:00 5mTalk | DeepFD: Automated Fault Diagnosis and Localization for Deep Learning Programs Technical Track Jialun Cao Department of Computer Science and Engineering, The Hong Kong University of Science and Technology, Meiziniu LI Department of Computer Science and Engineering, The Hong Kong University of Science and Technology, Xiao Chen Huazhong University of Science and Technology, Ming Wen Huazhong University of Science and Technology, Yongqiang Tian University of Waterloo, Bo Wu MIT-IBM Watson AI Lab in Cambridge, Shing-Chi Cheung Hong Kong University of Science and Technology DOI Pre-print Media Attached | ||
21:05 5mTalk | Fast Changeset-based Bug Localization with BERT Technical Track Agnieszka Ciborowska Virginia Commonwealth University, Kostadin Damevski Virginia Commonwealth University Pre-print Media Attached | ||
21:10 5mTalk | Multilingual training for Software Engineering Technical Track Toufique Ahmed University of California at Davis, Prem Devanbu Department of Computer Science, University of California, Davis DOI Pre-print Media Attached | ||
21:15 5mTalk | NeuronFair: Interpretable White-Box Fairness Testing through Biased Neuron Identification Technical Track haibin zheng Zhejiang University of Technology, Zhiqing Chen Zhejiang University of Technology, Tianyu Du Zhejiang University, Xuhong Zhang Zhejiang University, Yao Cheng Huawei International, Shouling Ji Zhejiang University, Jingyi Wang Zhejiang University, Yue Yu College of Computer, National University of Defense Technology, Changsha 410073, China, Jinyin Chen College of Information Engineering, Zhejiang University of Technology, Hangzhou 310023, China DOI Pre-print Media Attached | ||
21:20 5mTalk | Type4Py: Practical Deep Similarity Learning-Based Type Inference for Python Technical Track Amir Mir Delft University of Technology, Evaldas Latoskinas Delft University of Technology, Sebastian Proksch Delft University of Technology, Netherlands, Georgios Gousios Endor Labs & Delft University of Technology DOI Pre-print Media Attached | ||
21:25 5mTalk | Decomposing Convolutional Neural Networks into Reusable and Replaceable Modules Technical Track Pre-print Media Attached |