Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Read by thought-leaders and decision-makers around the world. Phone Number: +1-650-246-9381 Email: [email protected]
228 Park Avenue South New York, NY 10003 United States
Website: Publisher: https://towardsai.net/#publisher Diversity Policy: https://towardsai.net/about Ethics Policy: https://towardsai.net/about Masthead: https://towardsai.net/about
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Founders: Roberto Iriondo, , Job Title: Co-founder and Advisor Works for: Towards AI, Inc. Follow Roberto: X, LinkedIn, GitHub, Google Scholar, Towards AI Profile, Medium, ML@CMU, FreeCodeCamp, Crunchbase, Bloomberg, Roberto Iriondo, Generative AI Lab, Generative AI Lab Denis Piffaretti, Job Title: Co-founder Works for: Towards AI, Inc. Louie Peters, Job Title: Co-founder Works for: Towards AI, Inc. Louis-François Bouchard, Job Title: Co-founder Works for: Towards AI, Inc. Cover:
Towards AI Cover
Logo:
Towards AI Logo
Areas Served: Worldwide Alternate Name: Towards AI, Inc. Alternate Name: Towards AI Co. Alternate Name: towards ai Alternate Name: towardsai Alternate Name: towards.ai Alternate Name: tai Alternate Name: toward ai Alternate Name: toward.ai Alternate Name: Towards AI, Inc. Alternate Name: towardsai.net Alternate Name: pub.towardsai.net
5 stars – based on 497 reviews

Frequently Used, Contextual References

TODO: Remember to copy unique IDs whenever it needs used. i.e., URL: 304b2e42315e

Resources

Take our 85+ lesson From Beginner to Advanced LLM Developer Certification: From choosing a project to deploying a working product this is the most comprehensive and practical LLM course out there!

Publication

MLOps Notes -1: The Machine Learning Lifecycle
Latest

MLOps Notes -1: The Machine Learning Lifecycle

Last Updated on January 5, 2023 by Editorial Team

Author(s): Akhil Theerthala

Originally published on Towards AI the World’s Leading AI and Technology News and Media Company. If you are building an AI-related product or service, we invite you to consider becoming an AI sponsor. At Towards AI, we help scale AI and technology startups. Let us help you unleash your technology to the masses.

MLOps Notes 1: The Machine Learning Lifecycle

Good day, everyone! And Happy NewΒ Year!

Akhil Theerthala here. Because of my personal obligations, I haven’t been able to write articles seriously until now. But finally, beginning today, I will begin contributing once a week to my mediumΒ page!

I haven’t taken any online courses in the last two months because I’ve been swamped with work, such as preparing for placements and completing project reports, etc., But now that I’ve started taking the Machine Learning For Engineering (MLOps) Specialization on Coursera and I’ll be sharing my notes on my medium. So, for the time being, check back every two days to catch up on myΒ notes!

Machine Learning Engineering for Production (MLOps) Specialization at DeepLearning.AI taught by Andrew Ng, Robert Crowe, Laurence Moroney and Cristian BartolomΓ© ArΓ‘mburu
Machine Learning For Engineering (MLOps) Specialization on Coursera.

What is this courseΒ about?

Till now, we have seen the training part of machine learning models. Now it is time for us to see how we put them into production and the challenges and requirements we face in the process. i.e., this course deals with what happens outside the Jupyter notebook.

Example: Let us look at the case of scratch detection of mobile phones. We use a device to identify whether the phone has scratches orΒ not.

Some terms!
Edge Device: device living inside the factories
Software : The program that controls the way edge device works.

In our case, we have inspection software that controls the camera that takes photos and passes them to the control software.

  • The control software calls an API, which passes the picture to the prediction server.
  • The prediction server has the model, whose job is to predict whether there is a scratch orΒ not.
  • This result is sent back to the control software, which behaves in specified ways to classify theΒ phone.
Illustration of a speech recognition model deployed in the cloud.
An example of a Scratch recognition system in a factory. Source: Deeplearning.AI, licensed under the Creative Commons Attribution-ShareAlike 2.0Β license.

This is generally termed cloud deployment. There is another type of deployment called edge deployment, where the factory keeps running irrespective of the internet connection. The POC (proof of concept) is ultimate the model that we build. But there is a lot out there that makes people believe that this POC is only 5~10% of a production deployment.

Illustration of all the steps of an entire ML infrastructure in production, scaled to the amount of time taken.
The requirements surrounding ML infrastructure. Source: [D. Sculley et. al. NIPS 2015: Hidden Debt in Machine LearningΒ Systems]

Well, the above image shows the entire components of an ml production deployment. In this course, the goal is to look into all the other processes. One of the easiest ways to look into these other components is to define a lifecycle for the machine learning project and explore each step whenΒ needed.

ML System lifecycle:

The generic lifecycle consists of 4 major parts, wherein in each part, we go through different processes or tasks and move on to the next part when satisfied. The partsΒ are

  • Scoping the projectβ€Šβ€”β€ŠHere, we define the project and the requirements and assumptions of the project that we workΒ on.
  • Dataβ€Šβ€”β€ŠBased on the scoping, we define the required data, label them and organize theΒ data.
  • Modelingβ€Šβ€”β€ŠUsing the final processed data, we select and train a model followed by performing error analysis. This is the part that we are most familiar with, and it happens in the Jupyter notebook.
  • Deploymentβ€Šβ€”β€ŠFinally, after testing the model, it is sent to the first deployment into production. After the deployment, we monitor and maintain the entire production system based on feedback from theΒ users.
General flowchart of an ML project that is in production. Starting from scoping the project, data defining and labelling, data preprocessing, modelling and deployment.
Lifecycle of a generic Machine learning project in production. Source: DeepLearning.AI, licensed under the Creative Commons Attribution-ShareAlike 2.0Β license.

Steps 3,4 are iterative processes, where, based on the need, we might have to redefine the particular step or retrain the model or some of the previous steps, like changing the assumptions taken or getting moreΒ data.

Let us look at an example by using the steps in this cycle: Consider a Speech Recognition system where based on the input audio clip, we will generate the transcript, along with a search function. In each step, we will be asking ourselves a few questions, which makes what we need to do a bitΒ clearer.

Step-1: Scoping

  • Defining the project: Speech recognition can have many applications. One such application is speech recognition for voiceΒ search.
  • What would be our key metrics in this case? (Completely problem dependent)
  • Some of the key metrics include accuracy, latency, throughput, etc.,
  • What is the target resource consumption? (In this step, we can see how the different systems are performing in the market and define aΒ target)

So mostly, what we do in this step is theoretically define what we have to do and how we do it, along with making necessary assumptions. This part will be discussed in detail later in theΒ course.

Step-2: Data

  • Is the data labeled consistently?
  • How much silence should we expect in theΒ clip?
  • How do you normalize the volume of all the different speakers so that the dataset can have all the voices in the sameΒ volume?

This step contains mostly Data scraping, processing, and feature engineering, which makes modeling with this dataΒ easier.

Step-3: Modelling

  • Select the training model, i.e., selecting the code, Hyperparameters, and Data, gives us theΒ model.
  • Generally, in research work, the data is fixed, and the code is played around with. Whereas, in Product Teams, it is found that holding the code fixed and playing around with the data and the hyperparameters is normal and efficient.
  • It is recommended that rather than taking a model-centric view, it is also recommended to take a pre-defined opensource models and then optimize it for the code and theΒ data.
  • Error analysis for the model is generally help us be more targeted toward selecting the data and verify that the model isΒ working.

Step-4: Deployment

  • We can deploy it in the following model, where the edge device is the mobileΒ phone.
  • The software uses the microphone and VAD (voice activity detection) module of the edge device (mobile phone) and sends the speech data to the production server.
  • The production server processes the request and sends the results according to the request. Generally, this production server is where our model pipeline isΒ stored.
  • Later, we have to keep monitoring the system to see for any concept drifts or other issues to make that the production tool delivers the value we envisioned.

The entire step is practically different and is highly application dependent. But the general essence of what we do is we try and deploy the model with a specific deployment pattern and later monitor it. If the model is performing according to our plan, then we go ahead with the full-scale deployment, with constant monitoring for different kinds of errors that can creepΒ up.

In the first course, we will be looking backward, starting from the deployment and then going each step back, i.e., the next article in the series will be on the Deployment part. We will also be looking into MLOps, which is an emerging discipline and comprises a set of tools and principles that support the best practices.

Thanks for stopping by! I will make sure that the next article comes out on January 3, 2023, as planned. So, keep an eye out for it! In the meantime, you can read my articles about my data analytics project or about how the popular Deep Learning Specialization compares to Udacity’s Deep Learning Nanodegree.


MLOps Notes -1: The Machine Learning Lifecycle was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.

Join thousands of data leaders on the AI newsletter. It’s free, we don’t spam, and we never share your email address. Keep up to date with the latest work in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming aΒ sponsor.

Published via Towards AI

Feedback ↓