[Context] Applying design principles has long been acknowledged as beneficial for understanding and maintainability in traditional software projects. These benefits may similarly hold for Machine Learning (ML) projects, which involve iterative experimentation with data, models, and algorithms. However, ML components are often developed by data scientists with diverse educational backgrounds, potentially resulting in code that doesn't adhere to software design best practices. [Goal] In order to better understand this phenomenon, we investigated the impact of the SOLID design principles on ML code understanding. [Method] We conducted a controlled experiment with three independent trials involving 100 data scientists. We restructured real industrial ML code that did not use SOLID principles. Within each trial, one group was presented with the original ML code, while the other was presented with ML code incorporating SOLID principles. Participants of both groups were asked to analyze the code and fill out a questionnaire that included both open-ended and closed-ended questions on their understanding. [Results] The study results provide statistically significant evidence that the adoption of the SOLID design principles can improve code understanding within the realm of ML projects. [Conclusion] We put forward that software engineering design principles should be spread within the data science community and considered for enhancing the maintainability of ML code.
翻译:【背景】长期以来,设计原则的应用被认为有助于传统软件项目的代码理解与可维护性。对于涉及数据、模型与算法迭代实验的机器学习项目而言,这些优势可能同样适用。然而,机器学习组件通常由具有多元教育背景的数据科学家开发,可能导致代码不符合软件设计最佳实践。【目标】为深入理解这一现象,我们研究了SOLID设计原则对机器学习代码理解的影响。【方法】我们开展了一项包含三轮独立实验的对照研究,共涉及100名数据科学家。研究对未应用SOLID原则的真实工业级机器学习代码进行了重构。每轮实验中,一组参与者获得原始机器学习代码,另一组获得整合了SOLID原则的机器学习代码。两组参与者均需分析代码并填写包含开放式与封闭式问题的理解度问卷。【结果】研究结果提供了具有统计学显著性的证据,表明采用SOLID设计原则能够提升机器学习项目的代码理解水平。【结论】我们提出,软件工程设计原则应在数据科学社区中推广,并考虑用于增强机器学习代码的可维护性。