24AI201
INTRODUCTION TO ARTIFICIAL INTELLIGENCE
OBJECTIVES:
• The Course will enable learners:
Understand the basics and applications of Artificial Intelligence.
Apply the basics of Python programming.
Use python libraries to solve simple problems.
Understand the different types of Machine Learning algorithms.
Solve real world problems using AI/ML.
Explore the various applications in the field of Artificial Intelligence and
Machine Learning.
INTRODUCTION TO ARTIFICIAL INTELLIGENCE
UNIT I ARTIFICIAL INTELLIGENCE
• Introduction – Types of AI – ANI, AGI, ASI – Narrow,
General, Super AI, Examples – AI problems – Production
Systems – State space Representation – Applications of AI
in various industries.
Unit II BASICS OF PYTHON
Introduction to Python programming – Arithmetic Operators
- values and types -variables, expressions, statements –
Functions – Conditionals and Recursion –Iteration.
Lists: Sequence, Mutable, Traversing, Operations, list
slices, list methods - Tuples: Immutable, Tuple Assignment,
Tuple as Return Values, Comparing and Sorting.
Unit III BASICS OF PYTHON
Introduction to Numpy - Multidimensional Ndarrays – Indexing
– Properties – Constants– Data Visualization: Ndarray Creation
– Matplotlib - Introduction to Pandas – Series –Dataframes –
Visualizing the Data in Dataframes - Pandas Objects – Data
Indexing and Selection – Handling missing data – Hierarchical
indexing – Combining datasets – Aggregation and Grouping –
Joins- Pivot Tables - String operations – Working with time
series – High performance Pandas.
Unit IV MACHINE LEARNING
Introduction – ML Algorithms Overview – Types –
Supervised – Unsupervised –Reinforcement Learning –
Introduction to Neural Networks – Working of Deep
Learning – Applications of DL – Ethical consideration in AI
and ML
Unit V CASE STUDIES
Disease Prediction – Share Price Forecasting – Weather
Prediction – Domain Specific Case Studies. List of Domain
Specific Case Studies: For CSE & allied: Sentiment analysis
of product reviews using machine learning
What is Artificial Intelligence?
Artificial Intelligence is composed of two words Artificial
and Intelligence, where Artificial defines "man-made," and
intelligence defines "thinking power", hence AI means "a
man-made thinking power."It is a branch of computer
science by which we can create intelligent machines which
can behave like a human, think like humans, and able to
make decisions.“
Ex: self-driving cars, playing chess, proving theorems,
playing music, Painting, etc.
Machine learning: Machine learning is an AI application that
automatically learns and improves from previous sets of
experiences without the requirement for explicit programming.
Deep learning: Deep learning is a subset of ML that learns by
processing data with the help of artificial neural networks.
Neural network: Neural networks are computer systems that
are loosely modeled on neural connections in the human brain
and enable deep learning.
Cognitive computing: Cognitive computing aims to recreate the
human thought process in a computer model. It seeks to imitate and
improve the interaction between humans and machines by
understanding human language and the meaning of images.
Natural language processing (NLP): NLP is a tool that allows
computers to comprehend, recognize, interpret, and produce human
language and speech.
Computer vision: Computer vision employs deep learning and pattern
identification to interpret image content (graphs, tables, PDF
pictures,
and videos)
• Self-Driving Cars
• Role of AI: Autonomous vehicles rely heavily on AI to navigate,
interpret surroundings, and make decisions.
• Key Technologies:
• Computer Vision: AI processes camera inputs to identify objects
like pedestrians, traffic signs, and other vehicles.
• Sensor Fusion: Combines data from LiDAR, radar, and GPS for a
360-degree view of the environment.
• Machine Learning: Predicts the behavior of other road users to
plan safe and efficient routes.
• Decision Making: Algorithms ensure real-time decisions such as
braking, acceleration, or lane-changing.
• 2. Playing Chess
• Role of AI: Chess engines use AI to evaluate possible moves,
predict opponent strategies, and choose optimal plays.
• Key Technologies:
• Game Tree Search: Algorithms like Minimax and Alpha-Beta Pruning
evaluate future moves and their outcomes.
• Reinforcement Learning: AI improves its performance by playing
millions of games against itself.
• Deep Learning: Systems like AlphaZero learn chess strategies
without prior human input.
• Example: AlphaZero, Stockfish.
What is Artificial Intelligence?
Artificial Intelligence exists when a machine can have
human based skills such as learning, reasoning, and
solving problems
With Artificial Intelligence you do not need to
preprogram a machine to do some work, despite that
you can create a machine with programmed algorithms
which can work with own intelligence, and that is the
awesomeness of AI.
Why Artificial Intelligence?
With the help of AI, you can create such software or devices
which can solve real-world problems very easily and with
accuracy such as health issues, marketing, traffic issues, etc.
With the help of AI, you can create your personal virtual
Assistant, such as Cortana, Google Assistant, Siri, etc.
With the help of AI, you can build such Robots which can
work in an environment where survival of humans can be at
risk.
AI opens a path for other new technologies, new devices,
why do we need python for AI?
Ease of Learning and Use
Rich Libraries and Frameworks
Community Support
Integration with Other Tools
Platform Independence
Support for Rapid Prototyping
Data Handling
Before AI vs. After AI:
Self-Driving Cars
Healthcare Diagnosis
Customer Service
Agriculture
Entertainment
Manufacturing
Education
Types of AI
According to the capabilities of AI, they are
classified into three categories, which are
Narrow AI, or Weak AI (ANI)
General AI, or Strong AI, and (AGI)
Artificial Superintelligence (ASI)
Artificial Narrow Intelligence (ANI)
The most common type of AI in use today is artificial
narrow
intelligence, sometimes known as ‘narrow AI’ or ‘weak
AI.’ Narrow AI is a goal-oriented AI trained to perform a
specific task.
Ex:The virtual assistant on a smartphone, like Apple’s
Siri or Amazon’s Alexa, is a perfect illustration of ANI.
Artificial General Intelligence (AGI)
Strong AI, sometimes known as artificial general
intelligence, is a level of AI that, in theory, is capable
of carrying out any intellectual work that a human is
capable of.
Artificial Super Intelligence (ASI)
A degree of intelligence known as artificial
superintelligence (ASI) is superior to human intellect in
every way, including reasoning, creativity, and even
emotional intelligence.
Types of AI Based on Functionalities
• Artificial Intelligence (AI) can be classified based
on its functionalities into various types. Here are
the main types:
Reactive AI
Limited Memory AI
Theory of Mind AI
Self-Aware AI
Reactive AI: The Foundation of Artificial Intelligence
• Reactive AI is the most basic type of AI. It is
designed to respond to specific inputs with
predetermined outputs and does not have the
ability to form memories or learn from past
experiences.
• Reactive AI operates solely on the present data it
receives, making decisions based on immediate
information.
Key Characteristics of Reactive AI
• No Memory: Reactive AI does not store any past data
or experiences, so each interaction is treated as a new
one.
• Task-Specific: It is designed to perform specific tasks
and cannot adapt to new situations beyond its
programming.
• Lacks Understanding of Context: This type of AI does
not understand the broader context or the
Example of Reactive AI systems
IBM's Deep Blue
The chess-playing computer that famously defeated
world champion Garry Kasparov in 1997 is a classic
example of Reactive AI.
Deep Blue could evaluate a vast number of possible
moves and counter-moves in the game but had no
understanding of the game itself beyond the rules and
its programming.
It could not learn or improve from its experiences.
Limited Memory AI: Learning from the
Past
• Limited Memory AI builds upon Reactive AI by
incorporating the ability to learn from historical
data to make better decisions in the future.
• This type of AI can store past experiences and use
them to influence future actions, making it more
advanced and adaptable than Reactive AI.
Key Characteristics of Limited Memory AI
• Memory-Dependent: Limited Memory AI systems can
retain and use past data to improve their decision-making
processes.
• Training Required: These systems require training on
large datasets to function effectively, as they learn
patterns from historical data.
• Improved Adaptability: Unlike Reactive AI, Limited
Memory AI can adapt to new information and scenarios,
making it more versatile in dynamic environments.
Example of Limited Memory AI
Self-Driving Cars
Autonomous vehicles are a prominent example of Limited
Memory AI. These cars are equipped with sensors and
cameras that continuously gather data about the
environment. They use this data, along with stored
information from previous drives, to make real-time decisions
such as when to stop, accelerate, or change lanes. The more
data the car collects, the better it becomes at predicting and
responding to various driving scenarios.
Theory of Mind AI: Understanding Human Emotions and Beliefs
Theory of Mind AI represents a more advanced type of
AI that has the capability to understand and interpret
human emotions, beliefs, intentions, and social
interactions.
This type of AI is still in the research and development
phase, but it aims to create machines that can engage in
more natural and meaningful interactions with humans.
Key Characteristics of Theory of Mind AI
• Social Intelligence: Theory of Mind AI is designed to
understand and respond to human emotions and social
cues, making interactions more personalized and
effective.
• Human-Like Understanding: It can anticipate how humans
might react in certain situations, leading to more intuitive
and responsive AI systems.
• Complex Decision-Making: This type of AI can consider
multiple variables, including emotional states and social
contexts, when making decisions.
Example of Theory of Mind AI
Sophia the Robot
Developed by Hanson Robotics, Sophia is designed to
engage in human-like conversations and simulate
emotions through facial expressions and body language.
Although her responses are scripted and based on pre-
defined algorithms, Sophia represents an attempt to
create robots that can interact socially and recognize
human emotions.
Self-Aware AI: The Future of Artificial
Intelligence
Self-aware AI represents the most advanced and
theoretical type of AI. As the name suggests, self-aware
AI systems would possess a level of consciousness
similar to that of humans. They would be aware of their
own existence, have the ability to form their own
beliefs, desires, and emotions, and could potentially
surpass human intelligence.
Key Characteristics of Self-Aware AI
• Self-Consciousness: These AI systems would have a sense of self,
allowing them to understand their own existence and their place
in the world.
• Autonomous Decision-Making: Self-aware AI would be capable of
making decisions based on a deep understanding of itself and its
environment.
• Ethical Considerations: The development of self-aware AI raises
significant ethical questions, including the rights of such entities
and the potential risks of creating machines that could surpass
human intelligence.
Example of Self-Aware AI
Skynet (Terminator Series)
A military AI that becomes self-aware and perceives humans as a
threat, leading to global destruction.
HAL 9000 (2001: A Space Odyssey) (Heuristically Programmed
Algorithmic Computer)
A spaceship AI that becomes self-aware, developing emotions and
making independent decisions, even turning against humans.
Ava (Ex Machina)
A humanoid AI that gains self-awareness and manipulates humans
How Does AI Work?
Step 1: Data collection The first step in any AI project is
gathering data. This could be anything from pictures and text
to more complex data like human behavior. The data serves as
the raw material that the AI system will learn from.
Step 2: Data preparation Once the data is collected, it needs to
be prepared and cleaned. This means removing any irrelevant
information and converting the data into a format that the AI
system can understand.
Step 3: Choosing an algorithm An algorithm is like a recipe
for how the AI system will process the data. Different
algorithms are better suited for different tasks. For example,
you might use a specific algorithm for image recognition and
another for natural language processing.
Step 4: Training the model The prepared data is fed into the
chosen algorithm to "train" the AI model. During this phase,
the model learns to make predictions or decisions based on
the data. Think of this as the AI system studying for an
exam.
Step 5: Testing the model
The model is tested to see how well it performs. If it's not accurate
enough, it may need to be trained further or adjusted.
Step 6: Deployment
Once the model is trained and tested, it's ready to be deployed
into a real-world application.
Example: Chabot answering customer queries, a medical AI
analyzing X-rays.
Step 7: Ongoing learning AI systems have the ability to learn and
adapt over time. They can improve their performance as they
gather more data, making them more efficient and accurate.
AI PROBLEMS
Problem formulation is the process of deciding what actions and
states to consider, given a goal
Well-Defined Problems And Solutions A problem in AI can be
formally defined by the following four components:
Maze Problem
A maze problem is a puzzle where you find a path from the
entrance to the exit of a maze without getting stuck in
dead ends.
8 puzzle Problem
Given a 3×3 board with 8 tiles (each numbered from 1 to 8)
and one empty space, the objective is to place the numbers
to match the final configuration using the empty space. We
can slide four adjacent tiles (left, right, above, and below)
into the empty space.
Water Jug Problem
• The Water Jug Problem typically involves two jugs with different
capacities. The objective is to measure a specific quantity of water by
performing operations like filling a jug, emptying a jug, or transferring
water between the two jugs. The problem can be stated as follows:
• You are given two jugs, one with a capacity of X liters and the other
with a capacity of Y liters.
• You need to measure exactly Z liters of water using these two jugs.
• The allowed operations are:
Fill one of the jugs.
Empty one of the jugs.
Pour water from one jug into another until one jug is either full or
empty.
Water Jug Problem
• Example Problem:
• Jug A: 3 liters
• Jug B: 5 liters
• Goal: Measure exactly 4 liters.
Water Jug Problem
• Example Problem:
• Jug A: 3 liters
• Jug B: 5 liters
• Goal: Measure exactly 4 liters.
•Fill Jug B: (0, 5)
•Pour Jug B into Jug A: (3, 2)
•Empty Jug A: (0, 2)
•Pour Jug B into Jug A: (2, 0)
•Fill Jug B: (2, 5)
•Pour Jug B into Jug A: (3, 4) → Goal state achieved!
Traveling Salesman Problem
The traveling salesman problems abide by a salesman and a set
of cities. The salesman has to visit every one of the cities starting
from a certain one (e.g., the hometown) and to return to the
same city. The challenge of the problem is that the traveling
salesman needs to minimize the total length of the trip.
Well-Defined Problems And Solutions
A problem in AI can be formally defined by the following four
components:
1. Initial State
Definition: The starting condition or configuration of the problem.
Example Scenarios:
Maze Problem: The agent’s starting position in the maze.
8 Puzzle Problem: The initial arrangement of the tiles in an 8-
puzzle game.
Chess Game: The standard initial arrangement of all chess pieces.
2. Successor Function
Definition: A function that defines the set of possible actions (and
resulting states) from a given state.
Example Scenarios:
Maze Problem: Moving up, down, left, or right generates new
states based on the maze's structure.
Chess Game: Moving a piece from one square to another generates
a new board configuration.
[Link] Test
Definition: A condition or function that determines if a given state
satisfies the problem's goal criteria.
Example Scenarios:
Maze Problem: Checking if the agent's position matches the exit
position.
8-Puzzle Problem: Verifying if the tiles are in the correct order.
4. Path Cost
Definition: A numerical value representing the cumulative cost of a sequence
of actions leading from the initial state to a particular state. Step Cost: Each
action has an associated cost, and the path cost is the sum of all step costs.
Example Scenarios:
Maze Problem: Path cost might be the total number of steps taken.
Traveling Salesman Problem: Path cost is the total distance traveled.
Robot Navigation: Path cost could represent energy consumption or time
taken
Problem Characteristics
Is the problem decomposable into a set of independent smaller sub
problems?
Decomposable Problem
Example: Suppose we want to solve the problem of computing the
integral of the following expression ∫(x2 + 3x + sin2 x * cos2 x) dx
• Can solve this problem by breaking it down into three smaller sub
problem
• Can be solved by thedivide and-conquer technique.
Use of decomposing problems:
Each sub-problem is simpler to solve
• Each sub-problem can be solved in parallel processing environment.
Non Decomposable problems.
The problem cannot be divided into smaller problems
• For example, Block world problem is non decomposable.
• Here, solution can be achieved by moving blocks
in a sequence such that goal state can be derived.
• Solution steps are interdependent and cannot be
decomposed in sub problems.
Can solution steps be ignored or at least undone if they prove to be unwise?
1. Ignorable : In which solution steps can be ignored (e.g.,
Theorem Proving).
Suppose we are trying to prove a mathematical theorem.
First we proceed with proving a lemma that we think will be
useful. Later we realize that it is not useful. So, Are we in
serious trouble?. No, Still we can prove the theorem, only we
need to ignore the first approach and start with another one
to prove the theorem.
Example2: (Recoverable):8 puzzle-(solution steps can be
undone)
8 puzzle: Objective is to rearrange a given initial
configuration of eight numbered tiles on 3 X 3 board (one
place is empty) into a given final configuration (goal state).
Rearrangement is done by sliding one of the tiles into
Empty Square.
Solved by backtracking so control strategy must be
implemented using a push down stack.
Example3: (Irrecoverable): Consider the game of chess. If a
wrong move is made, it can neither be ignored nor be
recovered. The thing to do is to make the best use of current
situation and proceed. This is an example of an irrecoverable
solution steps.
Ignorable problems can be solved using a simple control
structure that never backtracks. Recoverable problems can be
solved by a slightly more complicated control strategy that
allows backtracking. Irrecoverable problems will need to be
solved by a system that expands a great deal of effort making
each decision since decision must be final.
Is the problem’s universe predictable?
Certain-Outcome Problems
These problems have a well-defined state transition where each
action leads to a known and predictable outcome.
Examples:
• Eight Puzzle Problem – A sequence of moves leads to a definite
goal state.
• Water Jug Problem – The steps to measure a specific amount of
water are deterministic.
Planning: Since the outcome is predictable, a sequence of operators
(actions) can be planned in advance to guarantee a solution.
2. Uncertain-Outcome Problems
These problems involve randomness or unknown factors, making
their outcomes uncertain.
Examples:
• Playing Cards – The next card drawn is uncertain due to
shuffling and randomness.
• Chess Against an Opponent – The opponent's moves introduce
uncertainty.
Planning: The best a plan can do is maximize the probability of
success, but it cannot guarantee a solution in every case.
Is a good solution to the problem obvious without comparison to all other possible
solutions?
• There are two categories of problems — Any path problem and Best path problem.
Any path problem:
• satisfied with the solution, irrespective of the solution path taken.
• by heuristic methods we obtain a solution and we do not explore alternatives.
• can often be solved in a reasonable amount of time
Example: water jug and 8 puzzle
Best path problem:
• Not just any solution is acceptable but we want the best path solution.
• All possible paths are explored using an exhaustive search until the best path is
obtained.
• Best path problems are computationally harder.
• Example: Travelling sales man problem, which is the shortest path
problem.
Is the desired solution a state of the world or a path to a state?
Desired solution a state of the world :
• Consider the problem of natural language processing.
• Finding a consistent interpretation for the sentence “The bank
president ate a dish of pasta salad with the fork”.
• We need to find the interpretation but not the record of the processing
by which the interpretation is found.
Desired solution a path to a state?
• In water jug problem, it is not sufficient to report that we have solved,
but the path that we found to the state (2, 0). Thus the statement of a
solution to this problem must be a sequence of operations that
What is the role of knowledge?
• The size of the knowledge base available for solving the problem does
matter in arriving at a good solution.
• Take for example the game of playing chess, rules for determining
legal moves and some simple control mechanism is sufficient to arrive
at a solution.
• But additional knowledge about good strategy and tactics could help
to constrain the search and speed up the execution of the program.
The solution would then be realistic.
Does the task require interaction with a person?
• The solitary problem, in which there is no intermediate
communication and no demand for an explanation of the
reasoning process.
• The conversational problem, in which intermediate
communication is to provide either additional assistance to the
computer or additional information to the user.
Production System
A Production System is a type of computational model used in
Artificial Intelligence (AI) to simulate human problem-solving and
decision making processes.
It consists of a set of rules, a knowledge base, and a control
strategy to achieve specific goals
Key Components of a Production System in AI
The key components of production system includes:
1. Knowledge Base: This is the core repository where all the rules
and facts are stored. In AI, the knowledge base is critical as it
contains the domain-specific information and the if-then rules that
dictate how decisions are made or actions are taken.
Example: “IF the patient has a fever AND a rash, THEN there is a
possibility of measles.”
Key Components of a Production System in
AI
Inference Engine:
The inference engine is the mechanism that applies the rules to the
known facts to derive new facts or to make decisions. It scans the
rules and decides which ones are applicable based on the current
facts in the working memory. It can operate in two modes:
Forward Chaining (Data-driven): This method starts with the
available data and uses the inference rules to extract more data
until a goal is reached.
Key Components of a Production
System in AI
Key Components of a Production System in AI
Example of Forward Chaining:
Let’s consider a medical diagnosis system where the goal is to
determine if a patient has the flu. The system starts with known facts:
Fact 1: The patient has a fever.
Fact 2: The patient has a sore throat.
Rule: If the patient has a fever and sore throat, they might have the
flu.
The system applies the rule, leading to the conclusion that the patient
might have the flu.
Key Components of a Production System in AI
Properties of Forward Chaining:
• Data-Driven: The reasoning starts from available data (facts) and
works toward a goal.
• Bottom-Up Approach: It builds knowledge from facts, gradually
moving towards conclusions.
• Breadth-First Search Strategy: The inference engine explores multiple
rules simultaneously, applying them step by step.
• Possibility of Irrelevant Rules: Forward chaining may explore rules
that do not contribute to the final solution, making it less efficient in
some cases.
Key Components of a Production System in
AI
Backward Chaining (Goal-driven): This approach starts with a list
of goals and works backwards to determine what data is
required to achieve those goals.
Key Components of a Production System in AI
Example of Backward Chaining:
Consider the same medical diagnosis system with the goal of
determining if a patient has the flu.
Goal: Does the patient have the flu?
Rule: If the patient has a fever and sore throat, they might have the
flu.
Sub-goals:
Verify if the patient has a fever.
Verify if the patient has a sore throat.
Key Components of a Production System in AI
Properties of Backward Chaining:
Goal-Driven: Reasoning begins with a desired goal and searches for
evidence to support it.
Top-Down Approach: The system starts from the goal and works back
to find relevant facts.
Depth-First Search Strategy: The inference engine follows a path
deeply before exploring other possibilities, prioritizing each goal or
sub-goal in sequence.
Possibility of Infinite Loops: If not handled properly, backward chaining
may get stuck in loops while looking for evidence to support the goal.
Key Components of a Production
System in AI
3. Working Memory:
Sometimes referred to as the fact list, working memory holds
the dynamic information that changes as the system operates.
It represents the current state of knowledge, including facts
that are initially known and those that are deduced throughout
the operation of the system.
It is Updated continuously as rules are applied.
Key Components of a Production
System in AI
4. Control Mechanism:
This governs the order in which rules are applied by the
inference engine and manages the flow of the process. It
ensures that the system responds appropriately to changes
in the working memory and applies rules effectively to
reach conclusions or solutions.
Features of Production System in
Artificial Intelligence
1. Simplicity: The structure of each sentence in a production
system is unique and uniform as they use the “IF-THEN”
structure. This structure provides simplicity in knowledge
representation. This feature of the production system
improves the readability of production rules
[Link]: This means the production rule code the
knowledge available in discrete pieces. Information can be
treated as a collection of independent facts which may be
added or deleted from the system with essentially no
deleterious side effects
3. Modifiability: This means the facility for modifying rules. It
allows the development of production rules in a skeletal form
first and then it is accurate to suit a specific application.
4. Knowledge-intensive: The knowledge base of the
production system stores pure knowledge. This part does not
contain any type of control or programming information. Each
production rule is normally written as an English sentence;
the problem of semantics is solved by the very structure of
the representation.
Key Components of a Production System in AI
5. Control/Search Strategies
Control strategies crucially influence AI production systems
by guiding reasoning and determining how rules are
processed to make decisions or derive conclusions.
They dictate the sequence in which production rules are
applied and how the system processes data.
They play an essential role in efficient decision-making and
problem-solving.
Key Components of a Production System in AI
Control strategies influence the reasoning process in several ways:
Rule Selection:
Control strategies determine which production rules are selected for
execution based on the current state of the system and the goals in mind.
For example, forward chaining selects rules that match available data,
while backward chaining selects rules that lead to the desired goal.
Order of Execution: Additionally, they specify the sequence in which rules
are applied. Forward chaining proceeds from data to conclusions, while
backward chaining starts with the goal and works backward to establish
the necessary conditions.
Key Components of a Production
System in AI
Efficiency: Furthermore, control strategies aim to optimize the
reasoning process by minimizing unnecessary rule applications.
They help avoid redundant calculations and improve overall
system efficiency.
Goal Achievement: Finally, control strategies ensure the reasoning
process aligns with the system’s objectives. Whether finding a
solution, making a decision, or reaching a specific outcome, the
chosen strategy guides the system toward achieving these goals.
Production System Rules
The knowledge in a production system can be represented as a
set of rules along with a control system and database.
It can be written as:
Deductive Inference Rules
Abductive Inference Rules
The production rules are also known as condition-action,
antecedent - consequent, pattern-action, situation-response,
feedback-result pairs.
The production system rules are designed to direct a machine on
how to behave or react to a specific setting.
It includes a knowledge database, a set of rules and control
systems. The production rules are elements of knowledge
generally represented in the form
IF conditions ELSE actions
The condition component of the statement is also known as the
if part, antecedent, premise, or the left side of the rule.
The action component is also called the else part, succedent,
conclusion, consequent or the right side of the rule.
The actions are completed when the condition stands true, and
the rule is fired.
IF (Patient has fever AND cough) THEN (Patient has flu)
•Antecedent (Left Side): "Patient has fever AND
cough"
•Consequent (Right Side): "Patient has flu"
Types of Production System
A Monotonic Production System in AI is a system in which, once a
conclusion or fact is derived from a set of rules, that conclusion
cannot be retracted or altered by the addition of new information.
In other words, once a fact is inferred, it remains true regardless
of future changes or additions to the knowledge base
Types of Production System
Key Characteristics of a Monotonic Production System:
Stable Conclusions: The conclusions derived from the system are
fixed and cannot be invalidated or changed once they are made.
No Backtracking: Once a rule has been applied and a conclusion has
been drawn, the system will not revisit or change that conclusion
even if new information becomes available.
Predictability: Since conclusions are permanent, the system
operates predictably based on the given knowledge
Types of Production System
Example of Monotonic Production System:
Let's consider a medical expert system used to diagnose diseases
based on patient symptoms.
Facts: "The patient has a fever."
"The patient has a sore throat."
Rule:
If the patient has a fever and a sore throat, then the diagnosis is
strep throat.
Types of Production System
Process:
The system applies the rule and concludes that the patient has
strep throat based on the symptoms.
Monotonic Nature: Once the conclusion "The patient has strep
throat" is made, even if new facts are added (e.g., the patient now
has a rash), the system will not retract the earlier diagnosis of
strep throat
Types of Production System
A Partially Commutative Production System in AI refers to a system
where the order of rule application can affect the outcome in some
cases but not always. In other words, the commutative property (i.e.,
the outcome being independent of the order of applying rules) holds
only for certain sets of rules or conditions. This means that the
system may produce different results when rules are applied in
different sequences, but for some combinations, the order doesn't
matter.
Types of Production System
Key Characteristics of a Partially Commutative Production System:
1. Selective Order Dependency: The system's behavior may depend
on the sequence of rule applications in certain situations, but not in
others.
2. Rule-specific Commutativity: Some rules may be commutative
(order doesn’t affect outcome), while others may not.
3. Adaptable: These systems allow for both flexible and ordered
reasoning, depending on the specific context or rules applied.
Types of Production System
Example of a Partially Commutative Production System:
Simple Bank Account System Imagine a bank account system that
applies a series of rules to calculate the final balance in a customer's
account.
The rules include applying a deposit, a withdrawal, and a service fee.
Facts:
Initial balance: $100
Deposit: $50
Withdrawal: $20
Service Fee: $5
Types of Production System
Rules:
Rule 1: Add a deposit to the account balance.
Rule 2: Subtract a withdrawal from the account balance.
Rule 3: Subtract a service fee from the account balance.
Types of Production System
Commutative vs. Non-Commutative:
Commutative: Rule 1 (deposit) and Rule 3 (service fee) are commutative
because applying them in any order results in the same final balance:
Apply Rule 1 (Deposit) first:
Balance after deposit: $100 + $50 = $150
Service fee: $150 - $5 = $145
Apply Rule 3 (Service Fee) first:
Balance after service fee: $100 - $5 = $95
Deposit: $95 + $50 = $145
Final balance = $145 (same outcome, regardless of order).
Types of Production System
Non-Commutative: Rule 2 (withdrawal) is non-commutative because
applying it at different stages will affect the final result:
Apply Rule 2 (Withdrawal) first:
Balance after withdrawal: $100 - $20 = $80
Deposit: $80 + $50 = $130
Service fee: $130 - $5 = $125
Apply Rule 1 (Deposit) first:
Balance after deposit: $100 + $50 = $150
Withdrawal: $150 - $20 = $130
Service fee: $130 - $5 = $125
Types of Production System
Non-Monotonic Production System
A Non-Monotonic Production System is one where facts can be
retracted or changed as new information becomes available. Unlike
monotonic systems, which only add new facts, a non-monotonic system
may remove or revise its conclusions, which is particularly useful in
real-world situations where knowledge evolves.
Types of Production System
Key Features of Non-Monotonic Production Systems:
1. Revisable Facts: Information can be modified or removed as new
evidence contradicts previous conclusions.
2. Dynamic Knowledge: These systems can adjust their knowledge base
in response to new facts or changing conditions.
3. Increased Flexibility: Ideal for systems where uncertainty or
incomplete knowledge is present
Types of Production System
Example of Non-Monotonic Production System:
Smart Home Climate Control System:
Rules:
1. If the temperature inside the house is above 75°F, then turn on the air
conditioner.
2. If the temperature inside the house is below 68°F, then turn on the
heater.
3. If the user is at home, then adjust the temperature according to
personal preferences
Types of Production System
Scenario 1 (Before User Leaves Home):
The temperature inside the house is 80°F. The rule to turn on the air conditioner
is applied.
The system adjusts the temperature to keep the house cool.
Scenario 2 (After User Leaves Home):
The user leaves the house.
The system receives new input (the user is no longer at home).
The previous rule of adjusting the temperature according to the user’s
preferences is now retracted.
The system turns off the air conditioner to save energy and adjusts the
Types of Production System
Why Non-Monotonic?
The fact that the user is no longer at home changes the
system’s decision.
The system removes the previous behavior of adjusting the
temperature to the user’s preferences.
New facts (user leaving home) lead to a different conclusion,
demonstrating the system’s ability to change or retract
previous decisions.
Types of Production System
Commutative Production System
A Commutative Production System is one where the order of
rule application does not affect the outcome. This means
that regardless of the sequence in which the rules are
applied, the system will always arrive at the same final
conclusion
Types of Production System
Key Features:
1. Order does not matter: Rules can be applied in any sequence
without affecting the final result.
2. Consistency: The system’s behavior is predictable and
consistent, making it suitable for tasks where the order of
operations is flexible.
3. Parallel Rule Execution: In some cases, multiple rules can be
executed simultaneously because the order does not impact
the outcome.
Types of Production System
Example of a Commutative Production System:
1. Database Query Systems (Commutative Operations) In some
query processing systems, the order of operations doesn’t matter
if the operations are commutative. For example, in SQL queries:
Rules:
1. If you select records with a specific condition, then apply the
filtering rule.
2. If you group records by a column, then apply the grouping rule.
Types of Production System
1. Scenario 1 (Select and then Group):
2. Query: Select records with age > 25 and Group by city.
3. First, the system filters out records with age ≤ 25.
4. Then, it groups the remaining records by the city
Types of Production System
1. Scenario 2 (Group and then Select):
2. Query: Group by city and Select records with age > 25.
3. First, the system groups all the records by city.
4. Then, it applies the age filter on each group.
5. Result: Both queries give the same final outcome, as selection
and grouping are commutative operations in this case.