Skip to main content

Command Palette

Search for a command to run...

ML Development Lifecycle

Published
5 min readView as Markdown
ML Development Lifecycle
T

I am Lead Devops/Platform engineer. Author of a Novel, an avid reader.

[1]

Define business goals

ML starts with a business objective. Business stakeholders define the value, budget, and success criteria. Defining the success criteria or key performance indicators (KPIs) for the ML workload is critical.

ML problem framing

The problem formulation entails articulating the business problem and converting it into a machine learning problem.

The data scientist, data engineers, and ML architects work with the line of business subject matter experts (SMEs) to determine whether it is appropriate to use ML to solve the business problem. In this phase, the teams might work on discovery. They will determine whether they have the adequate data, skills, and so on to successfully deliver the business solution.

After they have formulated the problem, the next phase is the data preparation and preprocessing phase.

Data Collection and Preparation

To train an accurate ML model, developers use data processing to convert data into a usable format.

Data processing steps include data collection and integration, data preprocessing and data visualization, and feature engineering.

Data collection and integration ensures the raw data is in one centrally accessible place. Data preprocessing and data visualization involves transforming raw data into an understandable format. Feature engineering is the process of creating, transforming, extracting, and selecting variables from data. Some feature enigineering techniques include —

Feature Selection: Choosing the most relevant feature for a given task. This can improve model performance, reduce overfitting and speed up training.

Scaling: Ensuring that features are on similar scale so that some features don’t dominate others. Standardization and Normalization are common scaling techniques.

Binning/Bucketing: Technique that groups a set of values into smaller number of bins. Some different types of binning include — Discrete binning, Equal width binning, Custom bins, Median-centered binning.

Model development

Model development consists of model training, tuning, and evaluation.

It is an iterative process that can be performed many times throughout this workflow.

Initially, upon training, the model will not yield the expected results. Therefore, developers will do additional feature engineering and tune the model's hyperparameters before retraining.

This is one of the complex process that involves training machine learning algorithms with data to create models that can perform specific tasks. Basically you will be selecting whether your problem requires Supervised or Unsupervised learning. Below are few algorithms which are generally used.

Supervised Learning: Supervised learning is when we teach or train the machine using data that is well-labelled. Which means some data is already tagged with the correct answer.

Some of the applications are spam filtering, Image classification, medical diagnosis, fraud detection, Natural Language Processing (NLP).

Unsupervised Learning: is the training of a machine using information that is neither classified nor labeled and allowing the algorithm to act on that information without guidance.

Applications: Anomaly detection, Customer segmentation, image analysis, scientific discovery.

There are some complex ML algorithms also available for image processing and text processing which involve variations of neural networks (NN), to keep this article generic we will not deep dive into those.

We touched upon model training techniques, now we will see how models are evaluated. Initially when data is feed into the system (ML model) to train the model based, it might not get trained upto our expectations. To evaluate the model performance we apply evaluation methods.

For supervised learning we divide our dataset into three parts: Training set, validation set and test set.

Training set is used to train the model.

Validation and tests sets are the ones that we will use to evaluate the trained model performance.

The division of data can be in any proportion but commonly used are 80-10-10, 70-15-15, etc.

How you evaluate a ML model depends on what kind of ML problem you are working with. Below figure shows the classification and regression metrics.

*In next article I will cover the above numerical metrics in detail with examples.

Retrain

If the model doesn't meet the business goals, it's necessary to take a second look at the data and features to identify ways to improve the model. Building a model is usually an iterative process. This might also involve adjusting the training hyperparameters.

When you’re training machine learning models, each dataset and model needs a different set of hyperparameters, which are a kind of variable. The only way to determine these is through multiple experiments, where you pick a set of hyperparameters and run them through your model. This is called hyperparameter tuning [1]. Here are some examples of common hyperparameters:

Deployment

If the results are satisfactory, the model is deployed into production. The model is now ready to make predictions and inferences against the model.

Monitoring

The model monitoring system ensures the model is maintaining a desired level of performance through early detection and mitigation. Monitoring also helps debug issues and understand the model's behavior.

Iterations

The machine learning lifecycle is an iterative process. The model is continuously improved and refined as new data becomes available or as requirements change. This iterative nature helps ensure that the model remains accurate and relevant over time.


I hope this article helped to gain some knowledge on fundamentals of ML development lifecyle. The intention is to cover the behind scene functioning of the ML models. Democratization of GenAI gave us power to use it out of the box, but for software engineers and engineering executives it is important to also understand the basics of machine learning.

If you have any doubts or queries please reach out to me. I will be happy to explain and learn something new out of it.


[1]. https://aws.amazon.com/what-is/hyperparameter-tuning/

[2]. Model training - Amazon SageMaker AI