What Will You Learn?

By the end of this lesson, you will be able to:

  • Understand what modelling means in AI development
  • Differentiate between AI, Machine Learning, and Deep Learning
  • Compare Rule-Based and Learning-Based approaches
  • Identify when to use each approach
  • Understand how AI models learn from data

Imagine you’re teaching a child to identify fruits. You have two approaches:

Approach 1: Give them rules.
“If it’s round, red, and small, it’s an apple. If it’s yellow and curved, it’s a banana. If it’s orange and round, it’s an orange.”

Approach 2: Show them examples.
Show them 100 pictures of apples, 100 of bananas, 100 of oranges. From different angles. Of different shapes and sizes. And let them figure out the patterns themselves.

Both approaches work. But which is better? It depends on the situation.

This is exactly the choice we face in AI Modelling — the stage where we create the “brain” that will solve our problem. Let’s explore both approaches and understand when to use each.


What is Modelling in AI?

Modelling is the fourth stage of the AI Project Cycle where we build the system that will learn from data to make predictions or decisions. The model is the “intelligence” in Artificial Intelligence.

Think of it this way:

Project StageBuilding a House Analogy
Problem ScopingDeciding what kind of house you want
Data AcquisitionGathering materials (bricks, cement, wood)
Data ExplorationInspecting and preparing materials
ModellingActually building the house
EvaluationChecking if the house is well-built
DeploymentMoving in and living there

The model takes inputs (data) and produces outputs (predictions, decisions, classifications).

💡 Key Insight

A model is a simplified representation of reality that captures the important patterns needed to make predictions or decisions.


AI vs Machine Learning vs Deep Learning

Before diving into approaches, let’s clarify three related terms that often cause confusion. What I give you here is TL;DR version. You can read a deeper dive that I wrote for class 10 here.

The Hierarchy

┌─────────────────────────────────────────┐
│          Artificial Intelligence         │
│                                         │
│    ┌──────────────────────────────┐     │
│    │      Machine Learning        │     │
│    │                              │     │
│    │    ┌───────────────────┐     │     │
│    │    │   Deep Learning   │     │     │
│    │    └───────────────────┘     │     │
│    └──────────────────────────────┘     │
└─────────────────────────────────────────┘

Definitions

TermDefinitionExample
Artificial Intelligence (AI)Any system that mimics human intelligence to perform tasksChess-playing program, virtual assistant
Machine Learning (ML)A subset of AI where systems learn from data without being explicitly programmedEmail spam filter that learns from examples
Deep Learning (DL)A subset of ML using neural networks with many layers to learn complex patternsFace recognition, language translation

Simple Analogy

  • AI is like the entire education system
  • Machine Learning is like learning by practicing many examples
  • Deep Learning is like learning very complex subjects by processing huge amounts of information through many brain layers

Key Differences

FeatureTraditional AIMachine LearningDeep Learning
How it learnsRules written by humansLearns from dataLearns from vast data
Data neededLessModerateHuge amounts
Complexity it handlesSimple patternsMedium patternsComplex patterns
ExampleRule-based chatbotSpam filterFace recognition

Two Approaches to Modelling

Now let’s understand the two main approaches to build AI models.

1. Rule-Based Approach

In the Rule-Based approach, humans write explicit rules (if-then statements) that the system follows. The system doesn’t learn — it just follows instructions.

How it works:

IF [condition] THEN [action]

IF email contains "lottery winner" THEN mark as spam
IF temperature > 30°C THEN turn on AC
IF user says "hello" THEN respond "Hi! How can I help?"

Characteristics:

  • Humans define all the rules
  • Rules are explicit and understandable
  • No learning or adaptation needed
  • System follows rules exactly

💡 Key Insight

Such rule-based systems are also called expert systems.

2. Learning-Based Approach

In the Learning-Based approach, we show the system many examples, and it discovers patterns on its own. This is Machine Learning.

How it works:

Training Data:
Email 1: "You won $1 million lottery!" → Spam
Email 2: "Meeting at 3pm tomorrow" → Not Spam
Email 3: "Click here for free iPhone" → Spam
Email 4: "Project report attached" → Not Spam
... (thousands more examples)

AI learns: Emails with words like "won", "lottery", "free", "click here" are often spam

Characteristics:

  • Machine discovers rules from data
  • Rules may not be obvious to humans
  • System can improve with more data
  • Adapts to new patterns
  • Requires lots of training data

Comparing the Two Approaches

AspectRule-BasedLearning-Based
Who writes rules?HumansMachine discovers them
FlexibilityStatic — only does what it’s toldAdaptive — improves with experience
Data neededLittle to noneLarge amounts
TransparencyEasy to understand why decisions are madeSometimes hard to explain (black box)
Handling new situationsFails if rule doesn’t existCan generalize to new cases
Development timeFast if rules are knownSlower (needs data collection, training)
MaintenanceUpdate rules manuallyRetrain with new data
Best forWell-defined problems with clear rulesComplex patterns, lots of data

Rule-Based Approach: Deeper Look

If you want to build a rule-based system, here is how you can do that:

Step 1: Identify all possible use cases/situations
Step 2: Define rules for each use case/situation
Step 3: Implement rules in code
Step 4: Test and add more rules as needed

Example: Building a Simple Chatbot

Rules:
1. IF user says "hello" OR "hi" OR "hey"
   THEN respond "Hello! How can I help you today?"

2. IF user asks "what time is it"
   THEN respond with current time

3. IF user asks about "return policy"
   THEN respond "You can return items within 30 days with receipt."

4. IF no rule matches
   THEN respond "I'm sorry, I don't understand. Please rephrase."

Advantages of Rule-Based AI Models:

  1. Transparent: You can see and understand all rules
  2. Predictable: Same input always gives same output
  3. Quick to build: If domain knowledge exists
  4. No data needed: Just expert knowledge
  5. Easy to modify: Change one rule at a time

Disadvantages of Rule-Based AI Models:

  1. Limited scalability: Thousands of rules become unmanageable
  2. Can’t handle unknowns: No rule = no action
  3. Requires expertise: Experts must define all rules
  4. Brittle: Small variations can break the system
  5. No learning: Won’t improve on its own

Learning-Based Approach: Deeper Look

Here is how machine learning happens:

Step 1: Collect training data (inputs + correct outputs)
Step 2: Feed data to learning algorithm
Step 3: Algorithm discovers patterns (this is where the actual learning happens)
Step 4: Test with new data
Step 5: Improve with more data

The Learning Process

Think of it like a kid learning ttheir digits:

Training:
Show image of "7" → Tell AI "this is 7"
Show image of "3" → Tell AI "this is 3"
Show another "7" → Tell AI "this is 7"
... (repeat thousands of times)

AI discovers: "7s have a horizontal line at top and a diagonal line"
AI discovers: "3s have two bumps on the right side"

Testing:
Show new handwritten "7" → AI predicts "7" ✓
Show new handwritten "3" → AI predicts "3" ✓

Types of Machine Learning

TypeHow It LearnsExample
Supervised LearningFrom labeled examples (input + correct answer)Learning to identify spam from labeled emails
Unsupervised LearningFinds patterns without labelsGrouping customers by shopping behavior
Reinforcement LearningFrom rewards and punishmentsAI learning to play games

Advantages of Learning-Based AI Modelling:

  1. Handles complexity: Discovers patterns humans might miss
  2. Scales well: More data = better performance
  3. Adapts: Learns from new examples
  4. Generalizes: Applies learning to new situations
  5. Less manual work: No need to write every rule

Disadvantages of Learning-Based AI Modelling:

  1. Needs lots of data: Especially for deep learning
  2. “Black box”: Hard to understand why it decided something
  3. Can be biased: Learns biases present in training data
  4. Computationally expensive: Needs powerful computers
  5. May fail unexpectedly: In unusual situations

When to Use Each Approach

Use Rule-Based AI Modelling When:

SituationExample
Rules are well-known and fewTraffic lights (red=stop, green=go)
Transparency is criticalMedical diagnosis that must be explainable
Limited or no data availableNew product with no user history
Problem is simple and structuredBasic form validation
Regulations require clear rulesTax calculation systems

Use Learning-Based AI Modelling When:

SituationExample
Patterns are complexFace recognition
Lots of data availableRecommendation systems with millions of users
Problem changes over timeSpam filters (new spam tactics emerge)
Rules are hard to defineNatural language understanding
Accuracy is more important than explainabilityFraud detection

Hybrid Approach

Sometimes the best solution combines both. For instance, an Email system:

  • Rule-Based: Block emails from known spam addresses (explicit rule)
  • Learning-Based: Classify other emails based on content patterns (learned from data)

Real-World Examples of AI Models

Example 1: Rule-Based ATM

System: Bank ATM machine

Rules:

IF PIN entered incorrectly 3 times THEN block card
IF withdrawal amount > account balance THEN decline
IF withdrawal amount > daily limit THEN decline
IF all checks pass THEN dispense cash

Why Rule-Based works here:

  • Rules are clear and well-defined
  • Must follow banking regulations exactly
  • Every decision must be explainable and auditable

Example 2: Learning-Based Spam Filter

System: Gmail spam detection

Training data: Billions of emails labeled spam/not spam

Learned patterns:

  • Certain words more common in spam
  • Certain sender patterns suspicious
  • Links to suspicious domains
  • Email structure anomalies

Why Learning-Based works here:

  • System needs to adapt continuously
  • Spammers constantly change their tactics
  • Too many patterns for humans to write rules
  • Huge amounts of data is available for training

Example 3: Hybrid Recommendation System (Netflix)

Rule-Based component:

  • If user is under 13, don’t recommend R-rated content
  • If user just watched a movie, recommend sequels first

Learning-Based component:

  • Learn user preferences from viewing history
  • Find patterns in what similar users watched
  • Predict ratings for unseen content

Why Hybrid works here:
Some rules must be enforced (age restrictions), but preferences require learning from behavior.


Activity: Choose the Approach

For each scenario below, decide whether Rule-Based, Learning-Based, or Hybrid would be best. Explain why.

ScenarioYour ChoiceWhy?
1. Calculator that adds numbers
2. Translating English to Hindi
3. Deciding if a loan should be approved
4. Recognizing faces in photos
5. Setting thermostat temperature

(Answers in Answer Key)


Quick Recap

  • Modelling is the fourth stage of the AI Project Cycle where we build the actual “brain” of the system.
  • AI is the broad field; Machine Learning is AI that learns from data; Deep Learning uses complex neural networks.
  • Rule-Based approach: Humans write explicit rules. Best for well-defined problems with clear rules.
  • Learning-Based approach: Machine discovers patterns from data. Best for complex problems with lots of data.
  • Rule-Based is transparent and predictable but limited and static.
  • Learning-Based is adaptive and scalable but needs lots of data and can be a “black box.”
  • Hybrid approaches combine both for complex real-world systems.
  • Choose your approach based on data availability, problem complexity, and need for transparency.

Next Lesson: How to Evaluate AI Models: True Positive, False Positive and Model Accuracy Explained

Previous Lesson: Data Exploration and Visualization: How to Find Patterns and Trends in Your AI Data


EXERCISES

A. Fill in the Blanks

  1. Modelling is the ___________________ stage of the AI Project Cycle.
  2. Machine Learning is a subset of ___________________.
  3. Deep Learning uses ___________________ networks with many layers.
  4. In Rule-Based approach, ___________________ write the explicit rules.
  5. Learning-Based approach discovers patterns from ___________________.
  6. Rule-Based systems are also called ___________________ Systems.
  7. Machine Learning that uses labeled examples is called ___________________ Learning.
  8. A disadvantage of Learning-Based is that it can be a “___________________ box.”
  9. Gmail spam filter uses a ___________________-Based approach.
  10. The combination of both approaches is called a ___________________ approach.

B. Multiple Choice Questions

1. Which stage of the AI Project Cycle is Modelling?

(a) Second
(b) Third
(c) Fourth
(d) Fifth

2. Which is the correct hierarchy?

(a) Deep Learning > Machine Learning > AI
(b) AI > Deep Learning > Machine Learning
(c) AI > Machine Learning > Deep Learning
(d) Machine Learning > AI > Deep Learning

3. In Rule-Based approach:

(a) Machine discovers rules
(b) Humans write explicit rules
(c) System learns from data
(d) No rules are needed

4. Learning-Based approach requires:

(a) No data
(b) Very little data
(c) Large amounts of data
(d) Only rules

5. Which is NOT an advantage of Rule-Based systems?

(a) Transparent
(b) Predictable
(c) Adaptive to new situations
(d) Easy to modify

6. Supervised Learning uses:

(a) Unlabeled data
(b) Labeled data with correct answers
(c) No data at all
(d) Reward and punishment

7. Which approach is best for face recognition?

(a) Rule-Based
(b) Learning-Based
(c) Neither
(d) Rules only

8. A “black box” problem means:

(a) The box is painted black
(b) Hard to understand why the AI made a decision
(c) The system doesn’t work
(d) Data is hidden

9. Which is best for a simple calculator?

(a) Learning-Based
(b) Rule-Based
(c) Deep Learning
(d) Hybrid

10. Netflix recommendation system likely uses:

(a) Only Rule-Based
(b) Only Learning-Based
(c) Hybrid approach
(d) No AI


C. True or False

  1. Machine Learning is a broader field than Artificial Intelligence. (__)
  2. Rule-Based systems can learn and improve on their own. (__)
  3. Deep Learning requires large amounts of data. (__)
  4. Learning-Based systems always produce transparent, explainable decisions. (__)
  5. Rule-Based approach is best when rules are well-defined and few. (__)
  6. Spam filters typically use Learning-Based approaches. (__)
  7. Human experts write the rules in Learning-Based systems. (__)
  8. A hybrid approach combines Rule-Based and Learning-Based methods. (__)
  9. Rule-Based systems handle unknown situations well. (__)
  10. ATM machines typically use Rule-Based logic. (__)

D. Define the Following (30-40 words each)

  1. AI Modelling
  2. Artificial Intelligence
  3. Machine Learning
  4. Deep Learning
  5. Rule-Based Approach
  6. Learning-Based Approach
  7. Supervised Learning

E. Very Short Answer Questions (40-50 words each)

  1. What is Modelling in the AI Project Cycle?
  2. Explain the relationship between AI, Machine Learning, and Deep Learning.
  3. What is the Rule-Based approach? Give one example.
  4. What is the Learning-Based approach? Give one example.
  5. List three advantages of Rule-Based systems.
  6. List three advantages of Learning-Based systems.
  7. When should you use Rule-Based approach?
  8. When should you use Learning-Based approach?
  9. What is the “black box” problem in Machine Learning?
  10. What is a hybrid approach? Give an example.

F. Long Answer Questions (75-100 words each)

  1. Compare and contrast Rule-Based and Learning-Based approaches with examples.
  2. Explain AI, Machine Learning, and Deep Learning with their differences and examples.
  3. Describe the advantages and disadvantages of Rule-Based systems.
  4. Describe the advantages and disadvantages of Learning-Based systems.
  5. For a spam email filter, explain how both Rule-Based and Learning-Based approaches would work.
  6. Explain why Netflix would use a hybrid approach for its recommendation system.
  7. You need to build an AI for traffic signal management. Which approach(es) would you use and why?

ANSWER KEY

A. Fill in the Blanks – Answers

  1. fourth — Modelling follows Problem Scoping, Data Acquisition, and Data Exploration.
  2. Artificial Intelligence (AI) — ML is a subset of AI.
  3. neural — Deep Learning uses neural networks with many layers.
  4. humans — Humans/experts write rules in Rule-Based systems.
  5. data — Learning-Based discovers patterns from training data.
  6. Expert — Rule-Based systems are also called Expert Systems.
  7. Supervised — Supervised Learning uses labeled training data.
  8. black — “Black box” means decisions are hard to explain.
  9. Learning — Gmail uses ML to detect spam patterns.
  10. hybrid — Combining both approaches is called hybrid.

B. Multiple Choice Questions – Answers

  1. (c) Fourth — Modelling is the fourth stage.
  2. (c) AI > Machine Learning > Deep Learning — This is the correct hierarchy.
  3. (b) Humans write explicit rules — Experts define all rules.
  4. (c) Large amounts of data — ML needs lots of training data.
  5. (c) Adaptive to new situations — Rule-Based systems are NOT adaptive.
  6. (b) Labeled data with correct answers — Supervised learning needs labels.
  7. (b) Learning-Based — Faces are too complex for manual rules.
  8. (b) Hard to understand why the AI made a decision — Decisions aren’t transparent.
  9. (b) Rule-Based — Calculator follows explicit mathematical rules.
  10. (c) Hybrid approach — Netflix combines rules (age restrictions) with learning (preferences).

C. True or False – Answers

  1. False — AI is broader; ML is a subset of AI.
  2. False — Rule-Based systems don’t learn; they follow fixed rules.
  3. True — Deep Learning requires vast amounts of training data.
  4. False — Learning-Based can be “black boxes” — hard to explain.
  5. True — Rule-Based excels when rules are clear and manageable.
  6. True — Spam patterns are too complex for manual rules.
  7. False — In Learning-Based, machines discover patterns; humans don’t write rules.
  8. True — Hybrid combines strengths of both approaches.
  9. False — Rule-Based fails when encountering situations without defined rules.
  10. True — ATMs follow explicit banking rules.

D. Definitions – Answers

1. AI Modelling: The fourth stage of the AI Project Cycle where we build the actual system that will make predictions or decisions, choosing between rule-based or learning-based approaches.

2. Artificial Intelligence: The broad field of computer science focused on creating systems that can perform tasks requiring human-like intelligence, including reasoning, learning, and decision-making.

3. Machine Learning: A subset of AI where systems learn patterns from data without being explicitly programmed, improving performance through experience with more examples.

4. Deep Learning: A subset of Machine Learning using artificial neural networks with many layers to learn complex patterns from large amounts of data.

5. Rule-Based Approach: A modelling method where humans write explicit if-then rules that the system follows exactly, without learning or adaptation.

6. Learning-Based Approach: A modelling method where machines discover patterns from training data, enabling systems to generalize and adapt to new situations.

7. Supervised Learning: A type of machine learning where the system learns from labeled training data — examples with both inputs and the correct outputs.


E. Very Short Answer Questions – Answers

1. What is Modelling?
Modelling is the fourth stage of the AI Project Cycle where we create the system’s “brain” — the component that takes inputs and produces outputs (predictions, classifications, decisions) based on either rules or learned patterns.

2. AI, ML, DL relationship:
AI is the broadest field (any intelligent system). Machine Learning is a subset of AI that learns from data. Deep Learning is a subset of ML using complex neural networks. Each inner circle is more specialized.

3. Rule-Based approach:
Rule-Based approach uses explicit if-then rules written by humans. Example: A thermostat with rules like “IF temperature > 25°C THEN turn on AC” — it follows instructions without learning.

4. Learning-Based approach:
Learning-Based approach lets machines discover patterns from data. Example: Email spam filter that learns from thousands of labeled emails which words and patterns indicate spam.

5. Three advantages of Rule-Based:
Transparent (you can see all rules), Predictable (same input = same output), Quick to build (if domain knowledge exists). Also: easy to modify, no data required.

6. Three advantages of Learning-Based:
Handles complexity (discovers patterns humans miss), Scales well (more data = better results), Adapts (improves with new examples). Also: generalizes to new situations.

7. When to use Rule-Based:
When rules are well-known and few, when transparency is critical (medical/legal), when limited data is available, when the problem is simple, when regulations require explicit rules.

8. When to use Learning-Based:
When patterns are complex (face recognition), when lots of data is available, when problem changes over time (spam), when rules are hard to define manually.

9. “Black box” problem:
The “black box” problem means we can’t easily understand why a Learning-Based system made a particular decision. The patterns it learned are hidden inside complex mathematical computations.

10. Hybrid approach:
A hybrid approach combines Rule-Based and Learning-Based methods. Example: Netflix uses rules for age restrictions (Rule-Based) and learns user preferences from viewing history (Learning-Based).


F. Long Answer Questions – Answers

1. Compare Rule-Based and Learning-Based:
Rule-Based: Humans write explicit if-then rules. System follows exactly, doesn’t learn. Example: ATM that blocks card after 3 wrong PINs. Pros: transparent, predictable. Cons: can’t adapt, limited by human knowledge.

Learning-Based: Machine discovers patterns from training data. System improves with more data. Example: Gmail spam filter learning from billions of emails. Pros: handles complexity, adapts. Cons: needs lots of data, “black box” decisions.

2. AI, ML, and Deep Learning explained:
AI (Artificial Intelligence) is any system mimicking human intelligence — includes chess programs, virtual assistants. Machine Learning is AI that learns from data without explicit programming — like spam filters learning from examples. Deep Learning uses neural networks with many layers for complex patterns — like face recognition needing millions of images. AI is broadest, ML is subset, DL is subset of ML.

3. Advantages and disadvantages of Rule-Based:
Advantages: Transparent (all rules visible), Predictable (consistent outputs), Quick to build if experts know rules, No data needed, Easy to modify one rule at a time. Disadvantages: Limited scalability (thousands of rules unmanageable), Can’t handle unknowns (no rule = no action), Requires domain expertise, Brittle (small variations break it), No learning or adaptation.

4. Advantages and disadvantages of Learning-Based:
Advantages: Handles complex patterns humans miss, Scales with data, Adapts to new situations, Generalizes to unseen cases, Less manual rule-writing. Disadvantages: Needs lots of training data, “Black box” (hard to explain decisions), Can learn biases from data, Computationally expensive, May fail unpredictably in unusual situations.

5. Spam filter approaches:
Rule-Based: Write rules like “IF email contains ‘lottery winner’ THEN spam” or “IF sender domain is suspicious THEN spam.” Works for known patterns but spammers easily bypass by changing words.

Learning-Based: Train on millions of labeled emails. System discovers patterns — certain word combinations, sender behaviors, link patterns indicate spam. Adapts as spammers change tactics. Real Gmail uses learning-based with some rules for obvious cases.

6. Netflix hybrid approach:
Netflix needs Rule-Based for: Age restrictions (R-rated content blocked for children), Legal compliance (content availability by region), Explicit user preferences (blocked shows). Learning-Based for: Predicting what users will enjoy based on viewing history, Finding patterns in similar users’ preferences, Personalizing thumbnails and rankings. Hybrid works because some rules must be enforced, but preferences require learning from millions of behavioral patterns.

7. Traffic signal AI approach:
I would use a Hybrid approach. Rule-Based for: Emergency vehicle priority (always give green), Pedestrian crossing timing, Maximum wait time limits, Basic traffic law compliance. Learning-Based for: Adapting signal timing to actual traffic patterns, Predicting rush hour changes, Optimizing flow across multiple intersections, Learning from accidents to improve safety. Rule-Based ensures safety and legal compliance; Learning-Based optimizes efficiency and adapts to changing patterns.


Activity Answers

ScenarioChoiceWhy
1. CalculatorRule-BasedMathematical operations have clear, fixed rules (2+2=4)
2. English to Hindi translationLearning-BasedLanguage is complex with context, idioms, and exceptions
3. Loan approvalHybridRules for legal requirements; learning for risk assessment
4. Face recognitionLearning-BasedFaces have too many variations for manual rules
5. Thermostat temperatureRule-Based (or Hybrid)Basic rules work, but learning can optimize for preferences

Next Lesson: How to Evaluate AI Models: True Positive, False Positive and Model Accuracy Explained

Previous Lesson: Data Exploration and Visualization: How to Find Patterns and Trends in Your AI Data

Pin It on Pinterest

Share This