1. Preparing model for deployment
Now that we have looked into the design and development of the machine learning lifecycle, it's time to look into the last phase: deployment.
2. Runtime environment
During the development phase, data scientists have used training data to develop a machine learning model.
3. Development to deployment
The development takes place in the development environment, which is usually a data scientist's local computer or a virtual computer that can be controlled remotely, for example, in the cloud.
4. Development to deployment
Once the machine learning model is developed, we need to move the machine learning model into the production environment.
In the production environment, the machine learning model will make predictions based on actual, incoming data. Once deployed, the model is live and will create actual business impact.
5. Development to deployment
However, deploying a model to the production environment is not that simple because they are set in different runtime environments. A runtime environment is the environment in which the model is running. During the development, the model runs in the development runtime environment.
6. Runtime environments
Working in different runtime environments is similar to working in different kitchens. If we create a recipe in one kitchen, the results of the same recipe can be very different in another kitchen. There is a different set of pans, maybe one kitchen has different appliances, or a different group of chefs is running the kitchen. This can all affect the dish we are making.
7. Runtime environments
Similarly, in a development runtime environment, we may use different versions of Python and certain libraries. This causes problems because the same code may not work in the different runtime environments or may produce differing results.
8. Container
To mitigate different runtime environments, we can use something called a container. A container is like a special box that holds a computer program along with everything it needs to run, such as certain tools and settings. Imagine you have a recipe that only works in one specific kitchen, but you want to use it in any kitchen without a problem. A container helps by bringing the entire kitchen setup with the recipe, so it always works the same way, no matter where you use it. This makes it easier to move programs around and ensures they don’t break when they’re used on different computers.
9. Benefits containers
Using containers provides numerous benefits. Firstly, they are easier to maintain. Secondly, containers are very portable, since we only have to build them once, and then we can run them anywhere. Lastly, containers are fast to start up, since it just contains the required application.
10. Let's practice!
We have just learned all about preparing the machine learning model for deployment; let's go into some exercises.