Type4Py: practical deep similarity learning-based type inference for python.

Saved in:
Bibliographic Details
Title: Type4Py: practical deep similarity learning-based type inference for python.
Authors: Mir, Amir M.1 s.a.m.mir@tudelft.nl, Latoškinas, Evaldas1 e.latoskinas@student.tudelft.nl, Proksch, Sebastian1 s.proksch@tudelft.nl, Gousios, Georgios2 gousiosg@fb.com
Source: ICSE: International Conference on Software Engineering. 2022, p2241-2252. 12p.
Subjects: Dylan (Computer program language), Python programming language, Machine learning, Artificial intelligence, Cluster analysis (Statistics)
Abstract: 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 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. [ABSTRACT FROM AUTHOR]
Copyright of ICSE: International Conference on Software Engineering is the property of Association for Computing Machinery and its content may not be copied or emailed to multiple sites without the copyright holder's express written permission. Additionally, content may not be used with any artificial intelligence tools or machine learning technologies. However, users may print, download, or email articles for individual use. This abstract may be abridged. No warranty is given about the accuracy of the copy. Users should refer to the original published version of the material for the full abstract. (Copyright applies to all Abstracts.)
Database: Engineering Source
Full text is not displayed to guests.
FullText Links:
  – Type: pdflink
Text:
  Availability: 1
Header DbId: egs
DbLabel: Engineering Source
An: 185195777
AccessLevel: 6
PubType: Conference
PubTypeId: conference
PreciseRelevancyScore: 0
IllustrationInfo
Items – Name: Title
  Label: Title
  Group: Ti
  Data: Type4Py: practical deep similarity learning-based type inference for python.
– Name: Author
  Label: Authors
  Group: Au
  Data: <searchLink fieldCode="AR" term="%22Mir%2C+Amir+M%2E%22">Mir, Amir M.</searchLink><relatesTo>1</relatesTo><i> s.a.m.mir@tudelft.nl</i><br /><searchLink fieldCode="AR" term="%22Latoškinas%2C+Evaldas%22">Latoškinas, Evaldas</searchLink><relatesTo>1</relatesTo><i> e.latoskinas@student.tudelft.nl</i><br /><searchLink fieldCode="AR" term="%22Proksch%2C+Sebastian%22">Proksch, Sebastian</searchLink><relatesTo>1</relatesTo><i> s.proksch@tudelft.nl</i><br /><searchLink fieldCode="AR" term="%22Gousios%2C+Georgios%22">Gousios, Georgios</searchLink><relatesTo>2</relatesTo><i> gousiosg@fb.com</i>
– Name: TitleSource
  Label: Source
  Group: Src
  Data: <searchLink fieldCode="JN" term="%22ICSE%3A+International+Conference+on+Software+Engineering%22">ICSE: International Conference on Software Engineering</searchLink>. 2022, p2241-2252. 12p.
– Name: Subject
  Label: Subjects
  Group: Su
  Data: <searchLink fieldCode="DE" term="%22Dylan+%28Computer+program+language%29%22">Dylan (Computer program language)</searchLink><br /><searchLink fieldCode="DE" term="%22Python+programming+language%22">Python programming language</searchLink><br /><searchLink fieldCode="DE" term="%22Machine+learning%22">Machine learning</searchLink><br /><searchLink fieldCode="DE" term="%22Artificial+intelligence%22">Artificial intelligence</searchLink><br /><searchLink fieldCode="DE" term="%22Cluster+analysis+%28Statistics%29%22">Cluster analysis (Statistics)</searchLink>
– Name: Abstract
  Label: Abstract
  Group: Ab
  Data: 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 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. [ABSTRACT FROM AUTHOR]
– Name: AbstractSuppliedCopyright
  Label:
  Group: Ab
  Data: <i>Copyright of ICSE: International Conference on Software Engineering is the property of Association for Computing Machinery and its content may not be copied or emailed to multiple sites without the copyright holder's express written permission. Additionally, content may not be used with any artificial intelligence tools or machine learning technologies. However, users may print, download, or email articles for individual use. This abstract may be abridged. No warranty is given about the accuracy of the copy. Users should refer to the original published version of the material for the full abstract.</i> (Copyright applies to all Abstracts.)
PLink https://search.ebscohost.com/login.aspx?direct=true&site=eds-live&db=egs&AN=185195777
RecordInfo BibRecord:
  BibEntity:
    Identifiers:
      – Type: doi
        Value: 10.1145/3510003.3510124
    Languages:
      – Code: eng
        Text: English
    PhysicalDescription:
      Pagination:
        PageCount: 12
        StartPage: 2241
    Subjects:
      – SubjectFull: Dylan (Computer program language)
        Type: general
      – SubjectFull: Python programming language
        Type: general
      – SubjectFull: Machine learning
        Type: general
      – SubjectFull: Artificial intelligence
        Type: general
      – SubjectFull: Cluster analysis (Statistics)
        Type: general
    Titles:
      – TitleFull: Type4Py: practical deep similarity learning-based type inference for python.
        Type: main
  BibRelationships:
    HasContributorRelationships:
      – PersonEntity:
          Name:
            NameFull: Mir, Amir M.
      – PersonEntity:
          Name:
            NameFull: Latoškinas, Evaldas
      – PersonEntity:
          Name:
            NameFull: Proksch, Sebastian
      – PersonEntity:
          Name:
            NameFull: Gousios, Georgios
    IsPartOfRelationships:
      – BibEntity:
          Dates:
            – D: 01
              M: 05
              Text: 2022
              Type: published
              Y: 2022
          Titles:
            – TitleFull: ICSE: International Conference on Software Engineering
              Type: main
ResultId 1