DEV Community

Suresh Kumar Pallapothu
Suresh Kumar Pallapothu

Posted on Originally published at sureshpallapothu.in

Day 4: The AI Project Lifecycle — From Raw Data to Production Deployment

Building an AI system takes much more than writing code. Traditional software often follows a straight path: plan, build, test, ship. AI projects are different. They move through connected stages that keep looping back on each other, because what you learn from the data and from evaluation changes what you do next.

Diagram: The AI project lifecycle has seven stages, and it loops. When evaluation disappoints, the team goes back to the data or the features, and after launch monitoring starts the cycle again. See the animated version.

Here are the seven stages that take an AI project from an idea to a live system. To keep it concrete, we will follow one example all the way through: a subscription company that wants to predict which customers are about to cancel, so it can reach out before they leave. This is called customer churn.

In plain terms: Think of opening a restaurant. You decide what to serve (the problem), buy and prepare ingredients (data), choose the recipe (the model), taste-test it before opening (evaluation), start serving (deployment), and keep checking quality every day as tastes change (monitoring). A dish is never finished once and forgotten.

1. Problem Definition

This is the most important stage of the whole lifecycle. Before any code is written or any data is collected, you need a clear, measurable problem statement. That means naming the exact business objective and choosing the success metrics (KPIs) that will tell you whether the project worked, such as accuracy, precision, or return on investment (ROI).

In our example: "Reduce customer churn" is a wish. "Identify, a month ahead, the customers most likely to cancel, so the retention team can cut churn by 10% in six months" is a project.

Diagram: Defining the problem: a business goal becomes a measurable KPI, which becomes a clear target the model must hit before launch. See the animated version.

2. Data Acquisition and Preparation

On the technical side, the quality and quantity of your training data is the single biggest factor in how good your model can be. Teams commonly find that preparing data takes most of the project's time.

  • Acquisition: identify and collect the data you need, such as subscription history, support tickets and usage logs.
  • Cleaning: remove duplicates, handle missing values, and delete irrelevant records.
  • Normalization: data from different sources must be put into the same formats and units, so that the algorithm can compare like with like.

Diagram: Data preparation: duplicates are removed, missing values are handled, and mixed units are standardized so every record means the same thing. See the animated version.

3. Feature Engineering

Raw data is rarely ready for training. Feature engineering means selecting and transforming the variables so the model can learn patterns more easily. That includes creating new features from the data you already have, and encoding categories (like a city name) as numbers the mathematics can work with.

In our example: "days since the last order" and "months as a customer" are new features built from raw dates, and the city becomes a set of 0/1 columns.

Diagram: Feature engineering turns raw fields into numbers a model can learn from: categories are encoded, and new features such as 'days since last order' are created. See the animated version.

4. Model Selection and Training

With prepared data in hand, you choose an algorithm that fits the problem. A decision tree or a gradient-boosted model often works very well on tables of structured data, while a neural network is the natural choice for images, audio and text. Start simple: a simple model that works is easier to explain, cheaper to run and quicker to fix.

During training, the model sees the data again and again, adjusting itself until its loss falls to an acceptable level (you saw how in Day 3). To judge it honestly, the data is split into three parts:

Diagram: Data is split three ways. The model learns on the training set, settings are tuned on the validation set, and the untouched test set gives an honest final score. See the animated version.

5. Model Evaluation

Before launch, you check performance on the test set, data the model has never seen. This tells you whether it can handle new situations, or whether it has only memorized its training data. Memorizing is called overfitting.

In plain terms: A student who memorizes last year's exam answers scores perfectly on practice papers and then struggles on the real exam. A student who understands the subject does well on both. The test set is the real exam.

Diagram: A good model captures the pattern. Underfitting is too simple to see it, and overfitting memorizes the training data, noise included, and fails on new data. See the animated version.

Accuracy alone can mislead. If only 2% of customers churn, a model that always says "no churn" is 98% accurate and completely useless. So teams look at precision (when the model raises an alert, how often is it right?) and recall (of all the real cases, how many did it catch?).

Diagram: A confusion matrix shows exactly how a model is right and wrong. Precision and recall come from different parts of it, and both matter, not only overall accuracy. See the animated version.

If the results are not good enough, you go back: train longer, try a different model, or return to feature engineering, or even to the data.

6. Deployment

Deployment is where the trained model is connected to the real world.

  • Cloud deployment: the model runs on cloud servers, which scale easily to large numbers of users.
  • Edge deployment: the model runs directly on a local device, like an IoT sensor or a phone. This keeps latency very low and can work without internet.
  • Integration: the model is usually wrapped as an API, so apps and business systems can request predictions in real time.

Diagram: Cloud deployment runs the model on servers and scales to many users. Edge deployment runs it on the device itself for low latency and offline use. Either way, it is usually wrapped as an API. See the animated version.

7. Monitoring and Maintenance (MLOps)

The lifecycle does not end at launch. The real world keeps changing, and a model trained on yesterday's data slowly gets worse. This is commonly called data drift: the data arriving in production no longer looks like the data the model learned from. A related problem, concept drift, is when the relationship itself changes, for example when what makes a customer leave is different after a competitor's new offer.

Diagram: Models degrade after launch because real-world data changes. Monitoring catches the drop, and retraining on fresh data restores accuracy. See the animated version.

MLOps (Machine Learning Operations) is the set of practices that keeps a live model healthy: track its performance, detect drift, retrain it on fresh data, test it, and redeploy it, as a repeatable process.

Diagram: MLOps keeps a deployed model healthy: watch it, spot drift, retrain on fresh data, test, redeploy, and keep going. See the animated version.

The Big Picture

The model is only one part of an AI system. Most of the real work, and most of the risk, is in defining the right problem, preparing good data, testing honestly, and keeping the system healthy after launch. Teams that treat AI as a continuous cycle, and not a one-off build, are the ones whose projects survive contact with the real world.

Coming Up Next

Day 5: The math behind the magic: why linear algebra and probability matter.

ArtificialIntelligence #MLOps #DataScience #MachineLearning #TechEducation #AIImplementation #DataEngineering #Innovation


Originally published at https://sureshpallapothu.in/blog/day-4-ai-project-lifecycle, where this post includes animated diagrams.

Top comments (0)