Demystifying MLOps — Data Preparation, Model Preparation and Production

Royal Cyber Inc.
5 min readApr 7, 2022

Over the last two years, MLOps terms and concepts have often appeared in tech discussions and hit our newsfeed every time we are looking for some productive, ML-related stuff.

So, what are machine learning operations, and why it is gaining popularity nowadays? The concept of MLOps is not a new thing, and people in development have been doing the same thing for a long time.

Yes, I am talking about DevOps. But what is the role of DevOps in the machine learning life cycle? The main purpose of DevOps is to automate the life cycle of software development while maintaining the fast-paced demand of the market.

The purpose of MLOps is to automate the process of continuous integration and continuous delivery while catering to the growing business need. In short, MLOps is automating data pipelines to CI/CD of machine learning projects and finally serving model and continuously monitoring model and data.

Why MLOps?

To understand the purpose and need of MLOps, first, grasp the concept of the machine learning life cycle. The following diagram shows the typical life cycle of a machine learning application.

Figure 1: Typical ML Life Cycle

Data Preparation

In data preparation, the role of machine learning engineers is to analyze data and create new features via features engineering and then create a train test split for model training and testing, respectively.

Managing data itself is a different domain in the ML life cycle, where ML engineers have to spend most of their time dealing with data.

Where MLOps come in data preparation?

To create a fully automated ML pipeline, automate all necessary steps in data preparation. Nowadays, most businesses have big data, and the velocity of data arrival is one of its significant components.

This velocity of data arrival with time will introduce an enormous change in data distribution which ultimately becomes the reason for data drift.

To deal with data drift issues, ML engineers have to continuously monitor the statistical properties of data to deal with data drift issues.

All these data issues, namely automating data pipeline, pre-processing, and dealing with data issues, urges MLOps to deal with the initial stage of the ML cycle at scale.

Model Preparation

Once data is ready for machine learning models, the following core component of the ML life cycle is the training model, validation, and finally, tuning of selected models to make them ready for deployment.

How MLOps solve issues of the model prep stage?

In the early stage of model preparation which is a selection of models, ML practitioner needs to select the models which best fits the business requirements carefully.

This selection of the model itself is a hectic process because ML practitioners keep maintaining the records of experiments for model selection and then compare those results and finally decide which model fits the business parameters.

Traditionally, people were manually managing the records of those experiments and spending their time in operational stuff instead of actual experiments.

MLOps take care of these cumbersome steps, and ML engineers easily track the results of experiments and confidently select the accurate models.

Right after selecting models, the next ML engineer starts the training of the selected model and then conducts validation. After a model has been validated, the next step is to move the model to the tuning stage and perform hyper-parameter tuning.

Again, ML practitioners are stuck in another experiment tracking loop which is time-consuming in operational processes. All those experiments are easily trackable if MLOps is incorporated into the process.

Moving model into the production

Productionizing ML model is not the actual expertise of ML engineers. However, still ML engineers need to update models with the business requirements in such a fast-paced environment. Productionizing the ML model means creating a docker image, deploying the image on the endpoint, and eventually continuously monitoring the model’s performance.

MLOps for production

To stay aligned with the rapidly growing demands of business, MLOps works as a great practice of machine learning project management. Continuous Integration (CI) and continuous delivery (CD) are critical in keeping software applications with endless business needs.

ML engineers must incorporate CI/CD into their ML project life cycle to maintain a model with excellent accuracy. CI means model prep phase in ML jargon, whereas CD means productionizing model phase.

Another crucial thing that ML engineers tackle when they move models into the production environment is model drift.

Model drift means the model’s accuracy decays after some time due to changes in data distribution and growth in business needs, and other factors.

Fortunately, MLOps can also handle the model drift issue as it enforces the practices of continuous monitoring and logging of the deployed model, which ultimately notifies the ML developer of the decaying of model accuracy.

MLOps in Action

From the architectural and business perspective of machine learning applications, the architecture and practices followed by most organizations will give us the idea of why there is a need for MLOps?

Machine learning projects start with research; ML practitioner performs trials and experiments. When they succeed in their experiments, they move their experiments toward a production environment, as shown in Figure 2.

Most machine learning projects fail to meet business demands at scale because many best practices aren’t considered while performing experiments like testing at scale, speculating production data, model drift, and more.

Figure 2: Research-based approach

The best practice for ML projects is to use a production-ready approach to develop scaled machine learning applications. The production-ready approach is about designing an ML project pipeline at scale instead of research and then moving into production but doing ML tasks modularly.

The production pipeline should include the following critical components:

· Feature Store: Feature stores allow ML developers to share and reuse features at scale, with no need to build a separate pipeline for training data and serving data. It also helps detect data drift at an early stage so ML practitioners can proactively solve it.

· CI/CD in Model: CI/CD in MLOps automates the entire pipeline from model training to deployment, with proper code versioning and experiment tracking.

· Model Serving: This step contains creating a docker image of the model, registering this image, and creating an endpoint for the serving model.

· Continuous Monitoring: It is necessary to continuously monitor the model performance and data distribution to detect model and data drift at an early stage. This step will also trigger re-training of the model to stay accurate and fulfill the business demands.

In the end, MLOps is not any framework; instead, it is a set of practices to automate the entire ML workflow and create hassle-free machine learning projects.

Author bio:

Hassan Sherwani is the Head of Data Analytics and Data Science working at Royal Cyber. He holds a PhD in IT and data analytics and has acquired a decade worth experience in the IT industry, startups and Academia. Hassan is also obtaining hands-on experience in Machine (Deep) learning for energy, retail, banking, law, telecom, and automotive sectors as part of his professional development endeavors.

--

--

Royal Cyber Inc.

Royal Cyber Inc is one of North America’s leading technology solutions provider based in Naperville IL. We have grown and transformed over the past 20+ years.