Welcome back. We continue exactly according to the syllabus.
So far:
✅ Lesson 1 — What is AI?
✅ Lesson 2 — AI Problem-Solving & AI Engineer Mindset
✅ Lesson 3 — AI Terminology & Core Concepts
▶️ Lesson 4 — How Computers LearnToday we are going to understand the core engine behind Machine Learning:
How does a computer go from raw data to a trained model that can make predictions?
Don't worry about advanced mathematics yet. We will build the intuition first.
1. The Big Picture
At the highest level:
DATA
│
▼
PREPARE DATA
│
▼
TRAINING ALGORITHM
│
▼
MODEL
│
▼
NEW DATA
│
▼
PREDICTIONThis looks simple.
But almost everything we eventually learn in Machine Learning fits somewhere inside this pipeline.
2. Let's Start With a Real Problem
Imagine you work for a company that wants to predict whether a customer will leave.
The company has historical data:
| Customer | Age | Monthly Spend | Logins | Support Tickets | Churn |
|---|---|---|---|---|---|
| A | 25 | ₹1,000 | 25 | 1 | No |
| B | 45 | ₹500 | 2 | 8 | Yes |
| C | 31 | ₹2,000 | 30 | 0 | No |
| D | 52 | ₹600 | 3 | 7 | Yes |
| E | 28 | ₹1,500 | 20 | 1 | No |
We want to predict:
Will a new customer churn?
This is where Machine Learning begins.
3. Step 1 — Collect Data
The first requirement is data.
Business
│
▼
Historical DataData could come from:
Databases
APIs
CSV files
Data warehouses
Data lakes
Applications
Sensors
Logs
Documents
ImagesFor our example:
Customer Database
│
▼
Historical Customer RecordsThis is where your Data Engineering background becomes very useful.
An AI system is only as good as the data pipeline supporting it.
4. Step 2 — Identify Features
Remember from Lesson 3:
A feature is an input variable used by the model.
Our data:
Age
Monthly Spend
Logins
Support Ticketsare features.
We can represent them mathematically as:
X = [
Age,
Monthly Spend,
Logins,
Support Tickets
]For Customer A:
X = [25, 1000, 25, 1]The model receives these values as input.
5. Step 3 — Identify the Label
The thing we want to predict is called the target or label.
Here:
ChurnSo:
Features
│
▼
X
│
▼
MODEL
│
▼
PredictionAnd during training we also have:
Actual Answer
│
▼
yThis gives us the fundamental ML notation:
X = input/features
y = target/labelYou will see X and y everywhere in ML.
6. Step 4 — Split the Data
We generally don't want to train and evaluate a model on exactly the same data.
Why?
Because the model could simply memorize the training examples.
Instead:
COMPLETE DATASET
│
┌──────────┼──────────┐
▼ ▼ ▼
Training Validation Test
Data Data DataA common conceptual split might be:
70% → Training
15% → Validation
15% → TestThe exact percentages are not universal.
The important concept is:
Train on one portion and evaluate on data the model didn't train on.
7. Why Can't We Just Train on Everything?
Imagine you give a student exactly the questions that will appear in the final exam.
The student memorizes:
Question 1 → Answer A
Question 2 → Answer C
Question 3 → Answer BThen you give exactly those questions in the exam.
The student scores 100%.
Does that prove the student understands the subject?
No.
The same thing can happen with ML.
We want:
Generalization
The model should learn the underlying patterns rather than memorize the training examples.
8. What Is Training?
Now we reach the heart of ML.
We have:
Training Data
│
▼
Learning Algorithm
│
▼
Model ParametersThe model initially doesn't know the correct relationship.
Training repeatedly adjusts its parameters to reduce prediction error.
Conceptually:
Input
│
▼
Model
│
▼
Prediction
│
▼
Compare with Actual Answer
│
▼
Calculate Error
│
▼
Adjust Parameters
│
└───────────────┐
│
▼
Try AgainThis loop happens many times.
9. Prediction
Suppose the model sees:
Age = 50
Monthly Spend = ₹600
Logins = 2
Support Tickets = 8The model might output:
Churn Probability = 0.91Meaning:
91% estimated probability of churnThe business could then classify:
Probability > 0.5
↓
Likely ChurnThe exact threshold depends on the business problem.
10. What Is the Model Actually Learning?
This is a critical question.
The model is learning a relationship between inputs and outputs.
Conceptually:
X → yFor our example:
Customer Characteristics
│
▼
Churn RiskThe model might discover that combinations such as:
Low Logins
+
High Support Tickets
+
Low Engagementare associated with higher churn.
We don't necessarily tell it this rule explicitly.
The algorithm learns patterns from data.
11. A Very Simple Example
Let's temporarily forget customers.
Suppose:
Hours Studied → Exam Score
1 → 40
2 → 50
3 → 60
4 → 70
5 → 80We can observe a relationship:
More study
↓
Higher scoreWe could approximate it with:
Score = 30 + 10 × HoursSo if:
Hours = 6then:
Score = 30 + (10 × 6)
= 90This is an extremely simple model.
Real ML models can learn enormously more complicated relationships.
12. Model Parameters
In our simple equation:
Score = 30 + 10 × Hourswe have:
30 → bias/intercept
10 → weightThe model can learn these values from data.
Initially, imagine:
weight = 0
bias = 0The predictions would be terrible.
Training adjusts them:
weight → 10
bias → 30until predictions become good.
This is the basic idea behind parameter learning.
13. Loss Function
Now we need a way to answer:
"How wrong is the model?"
That's the job of a loss function.
Suppose the actual exam score is:
80and the model predicts:
70Error:
80 - 70 = 10A loss function converts prediction error into a numerical value.
Conceptually:
Prediction
│
▼
Compare with Actual
│
▼
LossThe training process tries to minimize the loss.
14. Think of Loss Like a Score
Imagine:
Loss = 100Very bad.
After training:
Loss = 50Better.
After more training:
Loss = 10Much better.
Ideally:
Loss ↓But remember:
A low training loss does not automatically mean the model will perform well on new data.
That's where generalization and overfitting become important.
15. Optimization
Now we have:
Model
+
Loss FunctionWe need a method to improve the model.
That's where optimization algorithms come in.
One extremely important algorithm is:
Gradient Descent
You don't need the mathematics yet.
Think of it like walking down a mountain.
●
/ \
/ \
/ \
/ \
/ ↓ \
/ ↓ \
/______↓______\
MinimumThe goal is to move toward a point where the loss is lower.
Conceptually:
Parameters
│
▼
Prediction
│
▼
Loss
│
▼
Gradient
│
▼
Update Parameters
│
└──────────────► RepeatThis will become extremely important when we study Deep Learning.
16. Learning Rate
Gradient descent needs to decide:
How big a step should we take?
That's the learning rate.
Imagine walking down a mountain.
Too small
Step
.
.
.
.
.You eventually reach the bottom, but it takes forever.
Too large
↓
Jump
↓
JumpYou might overshoot the minimum.
So:
Learning Rate
↓
Controls size of parameter updatesThis is an example of a hyperparameter.
17. Parameters vs Hyperparameters
This distinction is very important.
Parameters
The model learns them.
Examples:
Weights
BiasesHyperparameters
We choose them before/during training.
Examples:
Learning Rate
Number of Trees
Batch Size
Number of LayersConceptually:
MODEL
│
┌─────────┴─────────┐
▼ ▼
Parameters Hyperparameters
learned by model chosen by engineerWe will study this much more deeply later.
18. Epoch
In neural-network training, you'll hear:
Epoch
An epoch means the model has gone through the training dataset once.
For example:
Training Dataset
│
▼
Epoch 1
│
▼
Epoch 2
│
▼
Epoch 3
│
▼
...If we train for:
10 epochsthe model has processed the training dataset approximately ten times, subject to how the training procedure is defined.
19. Batch
Large datasets may be too large to process all at once.
So we divide them into smaller batches.
Suppose:
1,000,000 recordsand:
Batch Size = 1,000The model processes:
Batch 1 → 1,000 records
Batch 2 → 1,000 records
Batch 3 → 1,000 records
...This is particularly important for deep learning.
20. Epoch vs Batch vs Iteration
These terms often confuse beginners.
Suppose:
Dataset = 10,000 records
Batch size = 1,000Then approximately:
10 batches = 1 epochEach batch produces an update in many common training procedures.
So:
Batch
↓
One chunk of training data
Iteration / Step
↓
One parameter-update step
Epoch
↓
One pass through the training dataset21. Overfitting
Now we reach one of the most important concepts in ML.
Suppose the model becomes extremely good at the training data.
Training Accuracy = 99%Sounds great.
But on new data:
Test Accuracy = 65%Something went wrong.
The model has overfit.
It learned the training data too specifically instead of learning general patterns.
Think of a student who memorizes the textbook answers instead of understanding the subject.
22. Underfitting
The opposite problem is underfitting.
Suppose:
Training Accuracy = 60%
Test Accuracy = 58%The model isn't learning enough.
Conceptually:
Underfitting
→ Model too simple / insufficiently trained
Good Fit
→ Learns useful general patterns
Overfitting
→ Learns training data too specifically23. The Goal
We want:
Training Performance
+
Generalization
↓
Good ModelNot:
Training Performance onlyThe ultimate objective is good performance on unseen data.
24. Validation Data
Remember our dataset:
Training
Validation
TestValidation data helps us make development decisions.
For example:
Model A → Validation Accuracy 82%
Model B → Validation Accuracy 88%
Model C → Validation Accuracy 85%We might select Model B.
Then, after we finalize the approach, we use the test set for final evaluation.
This helps keep the test set more independent.
25. Generalization
Generalization means:
The model performs well on new, unseen data.
This is one of the most important concepts in ML.
Imagine:
Training Data
████████████████
Model learns patterns
New Data
████████████████
Model predicts successfullyThat's generalization.
26. Classification
Now let's introduce common ML problem types.
Classification
Predict a category.
Examples:
Spam / Not Spam
Fraud / Not Fraud
Churn / No Churn
Cat / Dog
Approved / RejectedOutput:
Class27. Regression
Regression predicts a continuous numerical value.
Examples:
House Price
Sales Forecast
Temperature
Demand
RevenueExample:
Input
↓
Model
↓
₹82,50,000That's regression.
28. Clustering
Clustering is an unsupervised learning technique.
You don't provide labels.
The algorithm tries to discover groups.
Customer Data
│
▼
Clustering
│
├── Group A
├── Group B
└── Group CExample:
Customers
│
▼
SegmentsWe'll study this in the Machine Learning phase.
29. The Complete ML Learning Loop
Now combine everything.
HISTORICAL DATA
│
▼
DATA PREPARATION
│
▼
TRAIN / VAL / TEST
│
▼
SELECT ALGORITHM
│
▼
MODEL
│
▼
PREDICTION
│
▼
CALCULATE LOSS
│
▼
OPTIMIZE MODEL
│
▼
UPDATE PARAMETERS
│
└───────────┐
│
▼
REPEAT
│
▼
VALIDATE MODEL
│
▼
FINAL TEST
│
▼
DEPLOY
│
▼
NEW PREDICTIONSThis is the foundation of Machine Learning.
30. But What About Deep Learning?
The same basic concept remains.
Data
↓
Neural Network
↓
Prediction
↓
Loss
↓
Backpropagation
↓
Gradient Descent
↓
Update Weights
↓
RepeatDeep Learning simply involves much more sophisticated models and training processes.
Later we'll unpack:
Neurons
↓
Layers
↓
Weights
↓
Activation Functions
↓
Forward Propagation
↓
Loss
↓
Backpropagation
↓
Gradient Descent31. What About LLMs?
This is where our roadmap eventually becomes very interesting.
An LLM is also a trained model.
At a very high level:
Massive Dataset
│
▼
Tokenization
│
▼
Neural Network
│
▼
Training
│
▼
Foundation Model
│
▼
Inference
│
▼
Generated TokensThe fundamental learning principles we are discussing today form the foundation beneath modern LLMs.
Later we'll study:
Neural Networks
↓
Deep Learning
↓
Attention
↓
Transformers
↓
Large Language Models
↓
Generative AISo don't underestimate today's lesson.
32. A Critical Distinction: Learning vs Memorization
Suppose we give a model:
2 + 2 = 4
3 + 3 = 6
4 + 4 = 8We don't want the model merely to memorize those exact examples.
We want it to learn a general relationship.
Then:
7 + 7should produce:
14This is the essence of generalization.
Of course, real neural networks and LLMs are considerably more complicated than this simple example.
33. Data Quality Matters
Here's a very important AI Engineering principle:
Garbage in, garbage out.
Suppose your training data contains:
Incorrect labels
Duplicates
Missing values
Bad measurements
Biased samples
Corrupted recordsYour model can learn from those problems.
So:
Bad Data
↓
Bad Training
↓
Bad Model
↓
Bad PredictionsThis is why Data Engineering is extremely important in AI Engineering.
34. AI Engineering Connection
Imagine your future production system:
DATA SOURCES
│
▼
DATA PIPELINES
│
▼
DATA QUALITY
│
▼
ML / AI MODEL
│
▼
INFERENCE
│
▼
APPLICATION/API
│
▼
USERYour Data Engineering skills will eventually connect directly with:
- Feature pipelines
- Training data
- Data quality
- Feature stores
- Vector databases
- RAG ingestion
- Model monitoring
- AI observability
That's why we're not treating AI Engineering as just "learn prompts."
35. A Real Example
Let's build a simple mental model for predicting house prices.
Data
Size
Bedrooms
Location
AgeTarget
PriceTraining
Historical Houses
│
▼
ML Algorithm
│
▼
Learn ParametersModel
House Features
│
▼
MODEL
│
▼
Predicted PriceNew house
Size = 2000 sqft
Bedrooms = 3
Location = Bangalore
Age = 5Model:
₹1.25 croreWe then compare predictions against actual values and evaluate how well the model performs.
36. Now Think Like an AI Engineer
A beginner thinks:
"Which model should I use?"
An AI Engineer first asks:
What is the business problem?
↓
What is the target?
↓
What data do we have?
↓
Is the data reliable?
↓
What type of ML problem is this?
↓
How will we evaluate it?
↓
How will we deploy it?
↓
How will we monitor it?This mindset is far more important than memorizing algorithms.
🧠 Lesson 4 — Core Mental Model
Memorize this:
DATA
│
▼
FEATURES
│
▼
LEARNING ALGORITHM
│
▼
MODEL
│
▼
NEW INPUT DATA
│
▼
PREDICTION
│
▼
EVALUATE RESULTDuring training:
Prediction
│
▼
Compare with Actual
│
▼
Loss
│
▼
Parameter Update
│
└──────────────► RepeatThe fundamental objective:
Learn patterns from training data that generalize to unseen data.
📚 Lesson 4 Vocabulary
You should now know:
| Concept | Meaning |
|---|---|
| Feature | Input variable |
| Label/Target | Value we want to predict |
| Training | Learning model parameters from data |
| Validation | Data used during development/tuning |
| Test | Unseen data for final evaluation |
| Model | Learned representation used for prediction |
| Loss | Numerical measure of prediction error |
| Optimization | Process of improving model parameters |
| Gradient Descent | Common optimization method |
| Learning Rate | Size of parameter updates |
| Epoch | One pass through training data |
| Batch | Subset of training data |
| Parameter | Value learned by model |
| Hyperparameter | Setting chosen by engineer |
| Classification | Predict a category |
| Regression | Predict a continuous value |
| Clustering | Discover groups in data |
| Overfitting | Model fits training data too specifically |
| Underfitting | Model fails to learn enough |
| Generalization | Performing well on unseen data |
🎯 Phase 1 Progress
PHASE 1 — AI FUNDAMENTALS
✅ Lesson 1 — What is AI?
✅ Lesson 2 — AI Problem-Solving & AI Engineer Mindset
✅ Lesson 3 — AI Terminology & Core Concepts
✅ Lesson 4 — Data → Model → Prediction
⬜ Lesson 5 — Types of Machine Learning
⬜ Lesson 6 — AI Project Lifecycle
⬜ Lesson 7 — AI Engineering vs ML Engineering vs Data Engineering
⬜ Phase 1 AssessmentWe are not moving to Python yet. Python comes after the AI fundamentals portion of the roadmap.
📝 Lesson 4 Classroom Test
Answer these in your own words. Don't worry about perfect answers.
Q1
What is the difference between a feature and a label?
Q2
Why do we split data into training, validation, and test sets?
Q3
What does a model actually learn during training?
Q4
What is a loss function?
Q5
What does gradient descent do?
Q6
What is the difference between a parameter and a hyperparameter?
Q7
Explain overfitting using a real-life example.
Q8
What is the difference between classification and regression?
Q9
Suppose we have:
Customer Age
Monthly Spend
Number of Logins
Support Ticketsand want to predict:
Customer ChurnIdentify:
Features =
Target =Q10 — Most Important
Explain this entire process in your own words:
Raw Data
↓
Features
↓
Training
↓
Model
↓
New Data
↓
Prediction
↓
EvaluationOnce you've answered these, we'll continue to Lesson 5 — Types of Machine Learning, where you'll learn Supervised Learning, Unsupervised Learning, Semi-Supervised Learning, Self-Supervised Learning, and Reinforcement Learning and understand where each is used in real AI systems.
No comments:
Post a Comment