The Prevalence of Code Smells in Machine Learning projects
Authors:
- 1 May 2021
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- p. 1-8
Abstract
Artificial Intelligence (AI) and Machine Learning (ML) are pervasive in the current computer science landscape. Yet, there still exists a lack of software engineering experience and best practices in this field. One such best practice, static code analysis, can be used to find code smells, i.e., (potential) defects in the source code, refactoring opportunities, and violations of common coding standards. Our research set out to discover the most prevalent code smells in ML projects. We gathered a dataset of 74 open-source ML projects, installed their dependencies and ran Pylint on them. This resulted in a top 20 of all detected code smells, per category. Manual analysis of these smells mainly showed that code duplication is widespread and that the PEP8 convention for identifier naming style may not always be applicable to ML code due to its resemblance with mathematical notation. More interestingly, however, we found several major obstructions to the maintainability and reproducibility of ML projects, primarily related to the dependency management of Python projects. We also found that Pylint cannot reliably check for correct usage of imported dependencies, including prominent ML libraries such as PyTorch.Keywords
All Related Versions
This publication has 12 references indexed in Scilit:
- Code smells and refactoring: A tertiary systematic review of challenges and observationsJournal of Systems and Software, 2020
- The Five Laws of SE for AIIEEE Software, 2019
- How developers engage with static analysis tools in different contextsEmpirical Software Engineering, 2019
- Boa Meets Python: A Boa Dataset of Data Science Software in Python Language2019
- Python Coding Style Compliance on Stack Overflow2019
- Software Engineering for Machine Learning: A Case Study2019
- Why Jupyter is data scientists’ computational notebook of choiceNature, 2018
- The Adoption of JavaScript Linters in Practice: A Case Study on ESLintIEEE Transactions on Software Engineering, 2018
- Shorter identifier names take longer to comprehendEmpirical Software Engineering, 2018
- Understanding metric-based detectable smells in Python software: A comparative studyInformation and Software Technology, 2018