Great, you’ve got approval to launch a machine learning model. Now you need to prepare your solution for production (e.g. tweaking the code, writing documentation and testing, etc.). Then you can launch your machine learning model in your production environment.
How To Launch a Machine Learning Model?
One way to launch a machine learning model is to save the trained model (for example, using joblib), including the entire preprocessing and prediction pipeline, and then load that trained model into your production environment.
Also, Read – Word Embeddings in Machine Learning.
To save a model using Joblib:
And then to load our saved model:
Another popular strategy is to launch your machine learning model in the cloud, for example on Google Cloud AI Platform (formerly known as Google Cloud ML Engine): simply save your model using joblib and download- le on Google Cloud Storage (GCS), then head to on Google Cloud AI Platform and create a new model version by pointing it to the GCS file. That’s all! This gives you a simple web service that does the load balancing and scaling for you.
It takes JSON requests containing the input data (for example, from a district) and returns JSON responses containing the predictions. You can then use this web service on your website (or whatever production environment you use).
Once you launch a machine learning model, it is not the end of the story. You should also write a monitoring code to check the live performance of your system at regular intervals and trigger alerts in the event of a drop.
It can be a big drop, possibly due to a broken component in your infrastructure, but be aware that it can also be a slight degradation that could easily go unnoticed for a long time. This is quite common because machine learning models tend to “rot” with time, as the world changes, so if the model was trained on the data of last year then it may not be suitable for data of this year. So you need to keep updating your model.
If you will launch a machine learning model trained to classify images of cats and dogs, it may also need to be recycled regularly, not because cats and dogs will mutate overnight, but because cameras constantly change, as well as aspect ratios, sharpness, brightness and aspect ratios. Plus, people may like different breeds next year or decide to dress their pets in tiny hats – who knows?
So you need to monitor the live performance of your model. But how do you do that? It depends. In some cases, model performance can be inferred from downstream metrics.
For example, if your model is part of a recommendation system and suggests products that are likely to be of interest to users, then it’s easy to monitor the number of recommended products sold each day. If that number decreases, the prime suspect is the model. This could be because the data pipeline is interrupted, or maybe the model needs to be recycled to new data.
However, it is not always possible to determine the performance of the model without any human analysis. Either way, you need to have a monitoring system in place, along with all the relevant processes to define what to do in the event of an outage and how to prepare for it. Unfortunately, it can take a lot of work. It is often a lot more work than building and training a model.
Also, Read – Rainfall Prediction with Machine Learning.
If the data continues to evolve, you will need to update your data sets and recycle your model regularly. I hope you liked this article on how to launch a machine learning model. Feel free to ask your valuable questions in the comments section below. You can also follow me on Medium to learn every topic of Machine Learning.