Why Do We Need Tests?
Learn the importance of testing in projects.
We'll cover the following
ML and software relationship
Machine learning is a kind of software that involves training algorithms to make predictions or decisions based on data input. It’s used to analyze patterns and trends in data and make predictions or recommendations based on that analysis.
Ordinary software, on the other hand, is a general term used to describe any computer program or application designed to perform a specific task or function. It can automate various tasks, from managing databases to running simulations and playing games.
As you may have noticed, applied machine learning relies heavily on software. This means that when working on an ML project, it is important to consider both the specific needs of the machine learning model and the general principles of software development.
The role of general testing in ML
To put it simply, even though machine learning is a unique field, it’s still software at its core. Just like a healthy diet for an athlete may consist of mostly regular, healthy food with a small percentage of special fitness supplements, the reliability of an ML software project should also follow a similar balance: the reliable ML is primarily testing (as in the case of regular software) and, secondly, ML-specific tests.
In other words, beginners in the ML field must familiarize themselves with the basic testing techniques that apply to any software project (covering about 80 percent of ML reliability). Only once these techniques have been mastered should they move on to techniques specific to machine learning (making up the remaining 20 percent).
By following this approach, you can ensure that your ML projects are reliable and robust, not just from an ML perspective, but also from a general software perspective. That’s why we’ll start our course with general software testing and then move on to ML-specific topics.
The importance of tests
In the “Who Should Take This Course?” lesson, we discussed the relationship between machine learning and software development and why it’s important to consider both the specific needs of the machine learning model and the general principles of software development when creating reliable ML projects. But why are tests specifically important in this process?
Tests are important for several reasons. Primarily, they help developers avoid defects and write less buggy code. However, this is only a narrow view of the benefits of automatic testing. What are the other benefits of testing?
-
Tests prevent unintended changes in existing logic, such as during refactoring, by helping to keep the old logic stable when new features affect certain components.
-
Additionally, tests can improve code readability by serving as a parallel world where a newcomer to the codebase can trace the reason for writing a specific piece of code.
-
Writing tests often pushes developers to better decompose code, as the heuristic “this code is hard to cover with tests” can serve as a warning sign for poor design.
-
Finally, a project that is well-covered with tests is easier to maintain, which means it will have a longer lifespan.
Overall, the importance of tests in ensuring the reliability and robustness of machine learning projects cannot be understated.