Courseiva
AIF-C01Chapter 2 of 16Objective 1.2

Machine Learning Lifecycle and Basics

How do you get a computer to learn, rather than just follow instructions? That is the core challenge the machine learning lifecycle solves. For AIF-C01, you need to understand the three key phases: training, inference, and evaluation — the heart of how every AI system works.

12 min read
Beginner
Updated Jul 23, 2026
Reviewed by Johnson Ajibi· Senior Network & Security Engineer · MSc IT Security

A simple way to picture Machine Learning Lifecycle and Basics

The Recipe Book Analogy

Have you ever tried to bake a cake by guessing the ingredients? That is what computing was like before machine learning. You had to tell the computer every single rule.

Consider a traditional recipe book. You follow step-by-step instructions: mix 200g flour, 100g sugar, 2 eggs, bake at 180C for 30 minutes. The result is predictable because the rules are fixed. Now imagine you want to teach someone to recognise a good cake by taste, without giving them exact proportions. You let them taste hundreds of cakes, each time telling them 'good' or 'bad'. Over time, they learn what makes a cake good: it is sweet but not too sweet, moist but not soggy. They have built a mental model from examples, not from a written recipe.

This is exactly the machine learning lifecycle. During 'training', you feed the computer thousands of labelled examples (like those cake tastings). It learns patterns and builds a mathematical model (the mental model). During 'evaluation', you test the model on new unseen cakes to see if it correctly identifies good ones. Only then, during 'inference', does the model make predictions on brand-new cakes in the real world. The lifecycle is iterative: if the model is bad at judging, you go back, give it more examples, and retrain until it gets it right.

How It Actually Works

Machine learning is a way of programming computers using examples instead of explicit rules. The lifecycle describes the loop you go through to build, test, and deploy a machine learning model. It is split into three main phases: training, evaluation, and inference.

Training is the learning phase. You start with a dataset: a collection of examples. Each example has features (the input variables) and a label (the correct answer). For instance, if you want a model to predict house prices, your dataset might contain 10,000 houses. Each house has features like number of bedrooms, square footage, and location. The label is the price the house actually sold for. The model goes through this data and adjusts its internal parameters (think of them as knobs or dials) to minimise the difference between its predicted price and the real price. This process is iterative: the model makes a guess, calculates how wrong it was (the loss), and tweaks the knobs to guess better next time. This repeats hundreds of thousands of times until the model's guesses are close to the real values.

Evaluation is the testing phase. You cannot just use the same houses you trained on to test the model — that would be like giving a student the answers to the exam before they take it. So you split your dataset into two parts: a training set and a test set. The model never sees the test set during training. After training is complete, you feed the test set features to the model and compare its predictions to the actual labels. Metrics like accuracy (for classification tasks) or mean absolute error (for regression tasks) tell you how well the model performs. If performance is poor, you go back and change the features, try a different type of model, or collect more data. This is the iterative nature of the lifecycle.

Inference is the deployment phase. Once the model passes evaluation, it is put into production — meaning it runs in the real world to make predictions on brand-new, unseen data. For example, a bank deploys a fraud detection model that analyses new transactions as they happen. The model processes millions of transactions per day. It does not learn during inference (that would be risky); it only uses the patterns it learned during training. However, over time the real world changes. People change their spending habits, and fraudsters invent new tricks. This is called concept drift. So the lifecycle is not one-and-done: you monitor the model's performance, and when it drops below a threshold, you collect new data, retrain the model, evaluate it again, and redeploy it. That is the full machine learning lifecycle.

Key terms to know for AIF-C01:

Features: The input variables the model uses to make a prediction.

Labels: The correct output for each example in the training data.

Dataset: The collection of examples used to train or test the model.

Model: The mathematical representation that maps features to predictions.

Training: The process of teaching a model on labelled data.

Evaluation: The process of testing the model on unseen data.

Inference: The process of using a trained model to make predictions on new data.

Overfitting: When a model learns the training data too perfectly, including its noise, and then performs poorly on new data. It is like memorising the answers instead of understanding the subject.

Underfitting: When a model is too simple to capture the patterns in the data. It does not learn enough from the training data.

Why does this lifecycle exist? Without it, you have no way to know if a model works before deploying it. Traditional programming writes explicit rules (if-then statements) which are brittle when the world gets complicated. Machine learning automatically discovers those rules from data, but the lifecycle ensures the rules are discovered safely and tested thoroughly.

Flowchart of the machine learning lifecycle: from problem definition through training, evaluation, deployment, and monitoring with iterative feedback loops.

Walk-Through

1

Problem Definition

You define what you want the model to predict and how success will be measured. For example, 'predict house prices' with success measured by mean absolute error. This step ensures the rest of the lifecycle has a clear goal.

2

Data Collection and Preparation

You gather historical data, clean it (handle missing values, remove duplicates), split it into training and test sets, and engineer relevant features. This is the most time-consuming step and directly impacts model quality.

3

Model Training

You feed the training data — features and labels — into a machine learning algorithm. The algorithm iteratively adjusts its internal parameters to minimise prediction error. The output is a trained model.

4

Model Evaluation

You use the held-out test set — which the model has never seen — to make predictions and compare them to the actual labels. Metrics like accuracy or F1 score tell you if the model is ready for deployment.

5

Deployment and Inference

If evaluation results are satisfactory, you deploy the model to a production environment where it processes new, unseen data and returns predictions. The model does not learn here; it only applies what it learned during training.

6

Monitoring and Retraining

You continuously monitor the model's performance in production. When it degrades (due to concept drift or data changes), you collect new labelled data, retrain the model, reevaluate, and redeploy. This closes the lifecycle loop.

What This Looks Like on the Job

Let us walk through a concrete example: a retail company building a model to predict which customers will cancel their subscription (churn prediction).

Step 1: Business problem definition The data science team meets with the marketing manager. They agree the goal is to predict churn within the next 30 days so the company can offer discounts to at-risk customers. The success metric is the model's accuracy on a held-out test set, with a particular focus on minimising false positives (offering discounts to customers who would not have churned, wasting money).

Step 2: Data collection and preparation The team pulls data from the company's database: customer demographics, subscription length, number of support calls, average monthly spend, and whether they clicked on recent promotional emails. This raw data is often messy — missing values, inconsistent formatting, outliers. The team cleans it, removes duplicate records, and splits it into training (80%) and test (20%) sets. They also create new features, such as 'days since last login' and 'change in monthly spend'.

Step 3: Model training The team selects several types of algorithms: logistic regression, random forest, and gradient boosted trees. They train each one on the training set. Training involves feeding the features and labels (churned or not churned) into the algorithm. The algorithm adjusts its parameters to minimise prediction error. This can take minutes to hours depending on data size.

Step 4: Model evaluation The team evaluates each trained model on the test set. They use metrics like:

Accuracy: How many predictions were correct out of total?

Precision: Of the customers the model flagged as churning, how many actually churned?

Recall: Of the customers who actually churned, how many did the model catch?

F1 score: A balanced measure of precision and recall.

The team chooses the model with the best F1 score on the test set, because the business cares about both catching churners and not bothering loyal customers.

Step 5: Deployment (inference) The chosen model is deployed to a cloud server (e.g., AWS SageMaker). Every night, the model runs on the entire customer database and generates a list of customers predicted to churn in the next 30 days. The marketing team receives this list and sends targeted discount offers. The model performs inference on new data every day — it does not learn from that new data; it only uses its fixed parameters.

Step 6: Monitoring and iteration After three months, the marketing manager notices that the model's performance has degraded: it is now missing many churners. The data scientist checks and finds that the company changed its pricing plan, altering customer behaviour. The model was trained on old behaviour. The team collects the last three months of new data, retrains the model from scratch, evaluates it, and deploys the updated version. This monitoring-retraining cycle is a critical part of the real-world ML lifecycle that the AIF-C01 exam tests.

How AIF-C01 Actually Tests This

The AIF-C01 exam focuses on testing your understanding of the machine learning lifecycle and the distinction between training, inference, and evaluation. Expect questions that present a scenario and ask which phase is happening. Here is what you need to know:

Exam topics you must master:

Identify which phase (training, inference, or evaluation) is described in a scenario. For example: 'A model is used to classify images in a production app' — that is inference. 'A model is tested on a held-out dataset with known labels' — that is evaluation.

Understand the purpose of splitting data into training and test sets. The exam loves asking why you cannot evaluate a model on the same data it was trained on. The answer is always: because the model has already seen that data, and it would give you an unrealistically high performance score (overfitting). The model might have memorised the training data rather than learning general patterns.

Define overfitting and underfitting. Traps: A question might describe a model with 99.9% accuracy on training data but 55% on test data. That is classic overfitting. Another trap: a model with low accuracy on both training and test data — that is underfitting.

Know the key metrics: accuracy, precision, recall, F1 score. You do not need to calculate them, but you need to understand what they measure. For example: precision is about avoiding false positives; recall is about avoiding false negatives.

Understand the iterative nature of the lifecycle. The exam might describe a team that trains a model, evaluates it, finds poor performance, and then collects more data or changes features. They want you to recognise this as part of the 'model training and improvement' phase, not a failure — it is normal iteration.

Features vs. labels: A common trap question gives a dataset and asks which column is the feature and which is the label. Remember: features are the inputs (what you measure), labels are the outputs (what you predict).

Trap patterns to watch for:

They might describe a model making predictions on new data in a production environment and ask 'what is this called?' The answer is inference, not evaluation. Evaluation only happens when you have the correct labels and compare predictions to them.

They might say 'a model is retrained with new data' and ask which lifecycle phase this is. It is part of training, not inference. Retraining is the same process as initial training, just with updated data.

They might confuse 'dataset' with 'model'. The dataset is the raw examples; the model is the learned patterns. A common question: 'A data scientist splits the dataset into training and test portions. What is the purpose of the test portion?' The answer is to evaluate the model's performance on unseen data.

Key definitions to memorise for the exam:

Training: Learning patterns from labelled data to create a model.

Inference: Using a trained model to make predictions on new data.

Evaluation: Measuring the performance of a trained model on unseen data.

Overfitting: Model performs well on training data but poorly on new data.

Underfitting: Model performs poorly on both training and new data.

Feature: Input variable.

Label: Output variable (the correct answer in training data).

Dataset: Collection of examples.

Memorise the three phases in order: first you train, then you evaluate, then you deploy for inference. If evaluation shows poor results, you go back to training (iteration). That is the lifecycle.

Key Takeaways

The machine learning lifecycle has three main phases: training, evaluation, and inference, completed in that order iteratively.

Training uses labelled data to teach a model; evaluation tests it on unseen data to check for overfitting; inference runs the model on new data in production.

You must always split your dataset into a training set and a separate test set to get an honest measure of model performance.

Overfitting means the model memorises the training data and fails on new data; underfitting means the model is too simple to capture real patterns.

Features are the input columns (predictors) and labels are the output column (correct answer) in a supervised learning dataset.

Concept drift occurs when the real world changes, making your model less accurate over time, which requires retraining with new data.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

Training

Uses a labelled dataset with known features and labels

Model parameters are adjusted to minimise prediction error

Can take hours or days depending on data size

Inference

Uses new, unseen data without known labels

Model parameters are fixed; no learning occurs

Typically happens in milliseconds or seconds per prediction

Overfitting

Model performs very well on training data (e.g., 99% accuracy)

Model performs poorly on test data (e.g., 55% accuracy)

Caused by model being too complex for the data

Underfitting

Model performs poorly on both training and test data (e.g., 60% on both)

Model is too simple to capture patterns in the data

Caused by model being too simple or having too few features

Features

Input variables given to the model to make a prediction

Can be multiple features per example (e.g., 10 columns)

Used in both training and inference

Labels

Correct output value for each training example

There is exactly one label per example in supervised learning

Only available in training data, not in inference data

Watch Out for These

Mistake

Training and inference happen at the same time — the model learns as it makes predictions in production.

Correct

Training and inference are separate phases. Training happens first on historical data. Inference happens later on new data, and the model does not change during inference.

In movies, AI is often shown learning in real-time. In reality, online learning (learning during inference) is rare and risky; most production systems use a fixed trained model.

Mistake

Evaluation means checking if the model runs without errors.

Correct

Evaluation means measuring how well the model's predictions match known correct answers on a test set. It is about accuracy and performance metrics, not just whether the code runs.

Beginners confuse debugging (does it run?) with evaluation (how accurate is it?). The exam tests the distinction.

Mistake

The dataset used for training and the dataset used for testing are the same, just shuffled.

Correct

They are separate, non-overlapping subsets. The test set is held out completely during training. Using the same data would give a false sense of performance because the model has already seen the answers.

It seems efficient to use all data for both training and testing, but it is a classic beginner error that leads to overfitting. The exam specifically tests this trap.

Mistake

Machine learning models always get better the more data you give them during training.

Correct

More data often helps, but it is not a guarantee. If the data is noisy, irrelevant, or if the model is too simple (underfitting), more data will not help. Quality and relevance matter as much as quantity.

The phrase 'more data beats better algorithms' is occasionally true, but beginners overgeneralise it. The exam tests the nuance that data quality is critical.

Mistake

A model with 100% accuracy on the training data is always the best model.

Correct

100% accuracy on training data is a red flag for overfitting. The model has likely memorised the training data, including noise, and will perform poorly on new, unseen data.

Common sense says perfect is good, but in machine learning, perfect training performance often means poor generalisation. The exam loves this confusion.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

What is the difference between training and inference in machine learning?

Training is the learning phase where a model discovers patterns from labelled data. Inference is the later phase where the trained model makes predictions on brand-new, unseen data. During inference, the model does not learn or change.

Why do we need a separate test set for evaluation?

If you evaluate a model on the same data it was trained on, it has already seen the answers and will appear more accurate than it actually is. A separate test set gives an honest measure of how well the model generalises to new, unseen data.

What does 'overfitting' mean in machine learning?

Overfitting happens when a model learns the training data too well, including its noise and random fluctuations, so it performs poorly on new data. It is like memorising the answers to a practice test instead of learning the subject.

Can a machine learning model learn continuously in production?

Rarely in practice. Most production models use offline training: they are trained on historical data, deployed fixed, and periodically retrained offline. Online learning (learning from each new data point) exists but is complex and risky.

What is a feature in machine learning?

A feature is an individual measurable property or input variable used by the model to make a prediction. For example, in a house price model, the number of bedrooms and square footage are features. The label is the actual price.

What happens if a model's performance drops after deployment?

This is called concept drift — the real-world patterns have changed since the model was trained. The solution is to collect new labelled data, retrain the model, evaluate it, and redeploy the updated version.

Terms Worth Knowing

Keep going

You've finished Machine Learning Lifecycle and Basics. Continue through the AIF-C01 study guide to build a complete picture of the exam.

Done with this chapter?