0% found this document useful (0 votes)
2 views8 pages

Module 4

The document discusses knowledge-based agents (KBA), which utilize a knowledge base and inference system to represent facts, reason, and update their knowledge based on environmental input. It outlines the operations performed by KBAs, the architecture of a generic KBA program, and the various levels of knowledge representation, including knowledge, logical, and implementation levels. Additionally, it introduces the Wumpus World as a practical example of a KBA environment, along with concepts of forward and backward chaining for reasoning, and addresses uncertainty and probabilistic reasoning in AI.

Uploaded by

nakshigoda1965
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

Module 4

The document discusses knowledge-based agents (KBA), which utilize a knowledge base and inference system to represent facts, reason, and update their knowledge based on environmental input. It outlines the operations performed by KBAs, the architecture of a generic KBA program, and the various levels of knowledge representation, including knowledge, logical, and implementation levels. Additionally, it introduces the Wumpus World as a practical example of a KBA environment, along with concepts of forward and backward chaining for reasoning, and addresses uncertainty and probabilistic reasoning in AI.

Uploaded by

nakshigoda1965
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Module 4

Knowledge Based Agent

Knowledge base is a set of representations of facts and information

• Knowledge level is a base level(initial knowledge) of an agent, which consists of domain-specific content
(information about the surrounding in which the agent is working)

• Knowledge based agent make use of the existing Knowledge along with the current input from the
environment in order to infer hidden aspects of the current state.

• Knowledge-based agents are those agents who have the capability of maintaining an internal state of
knowledge, reason over that knowledge, update their knowledge after observations and take actions.

These agents can represent the world with some formal representation and act intelligently.

• Knowledge-based agents are composed of two main parts: Knowledge-base and Inference system.

A knowledge-based agent must able to do the following:

1. An agent should be able to represent states, actions, etc.

2. An agent should be able to incorporate new percepts

3. An agent can update the internal representation of the world

4. An agent can deduce the internal representation of the world

5. An agent can deduce appropriate actions.

 The above diagram is representing a generalized architecture for a knowledge-based agent.

 The knowledge-based agent (KBA) take input from the environment by perceiving the environment. The
input is taken by the inference engine of the agent and which also communicate with KB to decide as per
the knowledge store in KB.

 The learning element of KBA regularly updates the KB by learning new knowledge.

**Knowledge base: Knowledge-base is a central component of a knowledge-based agent, it is also known


as KB.

 It is a collection of sentences

 These sentences are expressed in a language which is called a knowledge representation language. The
Knowledge-base of KBA stores fact about the world.
 Why use a knowledge base? Knowledge-base is required for updating knowledge for an agent to learn
with experiences and take action as per the knowledge.

***Inference system

 Inference means deriving new sentences from old. Inference system allows us to add a new sentence to
the knowledge base.

 A sentence is a proposition about the world. Inference system applies logical rules to the KB to deduce
new information.

 Inference system generates new facts so that an agent can update the KB.

 An inference system works mainly in two rules which are given as:

 Forward chaining  Backward chaining

***Operations Performed by KBA

 TELL: This operation tells the knowledge base what it perceives from the environment.

 ASK: This operation asks the knowledge base what action it should perform.

 Perform: It performs the selected action.

Following is the structure outline of a generic knowledge-based agents program:

function KB-AGENT(percept):

persistent: KB, a knowledge base

 t, a counter, initially 0, indicating time

 TELL(KB, MAKE-PERCEPT-SENTENCE(percept, t))

 Action = ASK(KB, MAKE-ACTION-QUERY(t))

 TELL(KB, MAKE-ACTION-SENTENCE(action, t))

t=t+1

 return action

 The knowledge-based agent takes percept as input and returns an action as output.

 The agent maintains the knowledge base, KB, and it initially has some background knowledge of the real
world.

 It also has a counter to indicate the time for the whole process, and this counter is initialized with zero.

 Each time when the function is called, it performs its three operations:

 Firstly it TELLs the KB what it perceives.

 Secondly, it asks KB what action it should take

 Third agent program TELLS the KB that which action was chosen.

 The MAKE-PERCEPT-SENTENCE generates a sentence as setting that the agent perceived the given percept
at the given time.
 The MAKE-ACTION-QUERY generates a sentence to ask which action should be done at the current time. 
MAKE-ACTION-SENTENCE generates a sentence which asserts that the chosen action was executed.

Various levels of knowledge-based agent:

1. Knowledge level

 Knowledge level is the first level of knowledge-based agent, and in this level, we need to specify what
the agent knows, and what the agent goals are.

 With these specifications, we can fix its behavior.

 For example, suppose an automated taxi agent needs to go from a station A to station B, and he
knows the way from A to B, so this comes at the knowledge level.

2. Logical level:

 At this level, we understand that how the knowledge representation of knowledge is stored.

 At this level, sentences are encoded into different logics. At the logical level, an encoding of
knowledge into logical sentences occurs.

 At the logical level we can expect to the automated taxi agent to reach to the destination B.

3. Implementation level:
 This is the physical representation of logic and knowledge.
 At the implementation level agent perform actions as per logical and knowledge level. At this
level, an automated taxi agent actually implement his knowledge and logic so that he can reach to
the destination.

WUMPUS World

 The Wumpus world is a cave which has 4/4 rooms connected with passageways. So there are total 16
rooms which are connected with each other.

 We have a knowledge-based agent who will go forward in this world.

 The cave has a room with a beast which is called Wumpus, who eats anyone who enters the room.

 The Wumpus can be shot by the agent, but the agent has a single arrow.

 In the Wumpus world, there are some Pits rooms which are bottomless, and if agent falls in Pits, then he
will be stuck there forever.

 The exciting thing with this cave is that in one room there is a possibility of finding a heap of gold. So the
agent goal is to find the gold and climb out the cave without fallen into Pits or eaten by Wumpus.

 The agent will get a reward if he comes out with gold, and he will get a penalty if eaten by Wumpus or
falls in the pit.

Pit: few rooms have bottomless pits; agent and even Wumpus can fall into pit if they come into that
room
Stench: stench experienced in a room which has Wumpus in its neighbourhood room

Breeze: Breeze experienced in a room which has pit in its neighbourhood room

Arrow: agent can shoot the arrow in straight line to kill Wumpus

Gold: one of the rooms glitters and which consists of Gold

PEAS of WUMPUS world

1. Performance measure:

 +1000 reward points if the agent comes out of the cave with the gold.

 -1000 points penalty for being eaten by the Wumpus or falling into the pit.

 -1 for each action, and -10 for using an arrow.

 The game ends if either agent dies or came out of the cave

2. Environment:

 A 4*4 grid of rooms.

 The agent initially in room square [1, 1], facing toward the right.

 Location of Wumpus and gold are chosen randomly except the first square [1,1].

 Each square of the cave can be a pit with probability 0.2 except the first square.

3. Actuators:  Left turn,  Right turn  Move forward  Grab  Release  Shoot.
4. Sensors:
 The agent will perceive the stench if he is in the room adjacent to the Wumpus. (Not diagonally). 
The agent will perceive breeze if he is in the room directly adjacent to the Pit.
 The agent will perceive the glitter in the room where the gold is present.
 The agent will perceive the bump if he walks into a wall.
 When the Wumpus is shot, it emits a horrible scream which can be perceived anywhere in the
cave.
 These percepts can be represented as five element list, in which we will have different indicators
for each sensor.
 Example if agent perceives stench, breeze, but no glitter, no bump, and no scream then it can be
represented as: [Stench, Breeze, None, None, None].

The Wumpus world Properties:

 Partially observable: The Wumpus world is partially observable because the agent can only perceive the
close environment such as an adjacent room.

 Deterministic: It is deterministic, as the result and outcome of the world are already known.

 Sequential: The order is important, so it is sequential.

 Static: It is static as Wumpus and Pits are not moving.

 Discrete: The environment is discrete.


 One agent: The environment is a single agent as we have one agent only and Wumpus is not considered
as an agent.

A. Forward Chaining

Forward chaining is also known as a forward deduction or forward reasoning method when using an
inference engine. Forward chaining is a form of reasoning which start with atomic sentences in the
knowledge base and applies inference rules (Modus Ponens) in the forward direction to extract more data
until a goal is reached.

The Forward-chaining algorithm starts from known facts, triggers all rules whose premises are satisfied, and
add their conclusion to the known facts. This process repeats until the problem is solved.

Properties of Forward-Chaining:

o It is a down-up approach, as it moves from bottom to top.

o It is a process of making a conclusion based on known facts or data, by starting from the initial state and
reaches the goal state.

o Forward-chaining approach is also called as data-driven as we reach to the goal using available data.

o Forward -chaining approach is commonly used in the expert system, such as CLIPS, business, and
production rule systems.

Consider the following famous example which we will use in both approaches:

Example:

"As per the law, it is a crime for an American to sell weapons to hostile nations. Country A, an enemy of
America, has some missiles, and all the missiles were sold to it by Robert, who is an American citizen."

Prove that "Robert is criminal." To solve the above problem, first, we will convert all the above facts into
first-order definite clauses, and then we will use a forward-chaining algorithm to reach the goal.

B. Backward Chaining

Backward-chaining is also known as a backward deduction or backward reasoning method when using an
inference engine. A backward chaining algorithm is a form of reasoning, which starts with the goal and
works backward, chaining through rules to find known facts that support the goal.
Properties of backward chaining:

o It is known as a top-down approach.

o Backward-chaining is based on modus ponens inference rule.

o In backward chaining, the goal is broken into sub-goal or sub-goals to prove the facts true.

o It is called a goal-driven approach, as a list of goals decides which rules are selected and used.

o Backward -chaining algorithm is used in game theory, automated theorem proving tools, inference
engines, proof assistants, and various AI applications.

o The backward-chaining method mostly used a depth-first search strategy for proof.

e.g. a doctor may suspect some disease and proceed by inspection of symptoms.

Uncertainty

• we have learned knowledge representation using first-order logic and propositional logic with certainty,
which means we were sure about the predicates.

• With this knowledge representation, we might write A→B, which means if A is true then B is true,
• but consider a situation where we are not sure about whether A is true or not then we cannot express
this statement, this situation is called uncertainty.

• So to represent uncertain knowledge, where we are not sure about the predicates, we need uncertain
reasoning or probabilistic reasoning.

Following are some leading causes of uncertainty to occur in the real world.

• Information occurred from unreliable sources.

• Experimental Errors

• Equipment fault

• Temperature variation

• Climate change.

Probabilistic Reasoning:

Probabilistic reasoning is a way of knowledge representation where we apply the concept of probability
to indicate the uncertainty in knowledge.

 In probabilistic reasoning, we combine probability theory with logic to handle the uncertainty.

We use probability in probabilistic reasoning because it provides a way to handle the uncertainty that is
the result of someone's laziness and ignorance.

In the real world, there are lots of scenarios, where the certainty of something is not confirmed, such as
"It will rain today," "behavior of someone for some situations,"

2 ways to solve uncertainty:


1. Bayes Rule

• Bayes’ Theorem is named after Reverend Thomas Bayes.

• It is a very important theorem in mathematics that is used to find the probability of an event, based on
prior knowledge of conditions that might be related to that event.

• Bayes’ Rule is used in Artificial Intelligence to update the probability of an event when new evidence is
available.

• Bayes’ rule helps us revise our belief after seeing new information.

•Example: A doctor may initially think a patient has a disease with low probability, but after a positive test
result, the probability increases. In such cases, we use Bayes’ Theorem.

• It is used where the probability of occurrence of a particular event is calculated based on other conditions
which are also called conditional.

P(A) Prior probability (initial belief about A)


P(B) Probability of evidence

P(B|A) Likelihood (probability of evidence if A is true)

P(A|B) Posterior probability (updated probability after evidence)

Belief / Bayesian network

• A Bayesian Network is a graph (diagram) used in AI to represent uncertainty using probability.

• It shows how different events are connected and how they influence each other.

• It is made of: Nodes (circles) → represent variables (like Rain, Fever) ; Edges (arrows) → show
dependency or influence

Means: • Rain affects wet ground • Wet ground affects slippery road

•A Bayesian network is a type of graphical model that uses probability to determine the occurrence of an
event.

•It is also known as a belief network or a causal network.

•Real world applications are probabilistic in nature, and to represent the relationship between multiple
events, we need a Bayesian network.

• It can also be used in various tasks including prediction, anomaly detection, diagnostics, automated
insight, reasoning, time series prediction, and decision making under uncertainty

•Bayesian Network consists of two parts:

1. Directed Acyclic Graph:


•Arrows show direction
•No loops allowed
2. Table of conditional probabilities.
Each node has a probability based on its parent. Example: P(Wet Ground | Rain)

• The generalized form of Bayesian network that represents and solve decision problems under uncertain
knowledge is known as an Influence diagram.

•There are two types of probabilities that you need to be fully aware of in Bayesian networks:

[Link] probability

•Joint probability is a probability of two or more events happening together. For example, the joint
probability of two events A and B is the probability that both events occur, P(A∩B). [Link]
probability •

Conditional probability defines the probability that event B will occur, given that event A has already
occurred. There are two ways joint probability can be represented:

You might also like