0% found this document useful (0 votes)
24 views70 pages

Chap 5 Knowledge Represent

Uploaded by

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

Chap 5 Knowledge Represent

Uploaded by

Sanjay Sahoo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 70

Knowledge-Based Agent in

Artificial intelligence
An intelligent agent
needs knowledge about the real
world for taking decisions
and reasoning to act efficiently.
Knowledge-based agents are those agents who have the
capability of followings:
 maintaining an internal state of knowledge
 reason over that knowledge
 update their knowledge after observations
 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
• Inference system
The architecture of knowledge-based agent(KBA):

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 (here 'sentence' is a
technical term and it is not identical to sentence in
English).
 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 :
• 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.
A generic knowledge-based agent:
function KB-AGENT(percept):
persistent: KB, a knowledge base t, a counter, initially 0, indicating ti
me
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:

a. Firstly it TELLs the KB what it perceives.

b. Secondly, it asks KB what action it should take

c. Third agent program TELLS the KB that which action was


chosen.
1. The MAKE-PERCEPT-SENTENCE generates a sentence as
setting that the agent perceived the given percept at the given
time.

2. The MAKE-ACTION-QUERY generates a sentence to ask


which action should be done at the current time.

3. MAKE-ACTION-SENTENCE generates a sentence which


asserts that the chosen action was executed.
Various levels of knowledge-based agent:

1. Knowledge level
2. Logical level
3. Implementation level
1. Knowledge level
• The 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’s goals are. With
these specifications, we can fix its behavior.
• For example, suppose an automated taxi age; in this
level, we need to specify what the agent knows and the
agent goal 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 the automated taxi agent to
reach 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.
Approaches to designing a knowledge-based agent:

There are mainly two approaches to build a


knowledge-based agent:
1. Declarative approach
2. Procedural approach
1. Declarative approach:
• We can create a knowledge-based agent by
initializing with an empty knowledge base and
telling the agent all the sentences with which we
want to start with.
• This approach is called Declarative approach.
2.Procedural approach:
In the procedural approach, we directly encode desired behavior as a
program code.
Which means we just need to write a program that already encodes the
desired behavior or agent.
In the real world, a successful agent can be
built by combining both declarative and
procedural approaches, and declarative
knowledge can often be compiled into more
efficient procedural code.
What is knowledge representation?
Humans are best at understanding, reasoning, and
interpreting knowledge. Human knows things,
which is knowledge and as per their knowledge
they perform various actions in the real world.
But how machines do all these things comes
under knowledge representation and reasoning.
We can describe Knowledge representation as follows:
 Knowledge representation and reasoning (KR, KRR) is the part of
Artificial intelligence which concerned with AI agents thinking and
how thinking contributes to the intelligent behavior of agents.
 It is responsible for representing information about the real world so
that a computer can understand and can utilize this knowledge to
solve complex real-world problems such as diagnosing a medical
condition or communicating with humans in natural language.
 It is also a way which describes how we can represent knowledge in
artificial intelligence. Knowledge representation is not just storing
data in some database, but it also enables an intelligent machine to
learn from that knowledge and experiences so that it can behave
intelligently like a human.
What to Represent:
Following is the kind of knowledge that needs to be
represented in AI systems:

Object: All the facts about objects in our world domain. E.g.,
Guitars contain strings, trumpets are brass instruments.

Events: Events are the actions which occur in our world.

Performance: It describe behavior which involves


knowledge about how to do things.
Meta-knowledge: It is knowledge about what we know.

Facts: Facts are the truths about the real world and what we
represent.

Knowledge-Base: The central component of the knowledge-


based agents is the knowledge base. It is represented as KB. The
Knowledgebase is a group of the Sentences (Here, sentences are
used as a technical term and not identical with the English
language).
Types of knowledge
Knowledge is awareness or familiarity gained by experiences of facts, data, and situations
1. Declarative Knowledge:
• Declarative knowledge is to know about something.
• It includes concepts, facts, and objects.
• It is also called descriptive knowledge and
expressed in declarative sentences.
• It is simpler than procedural language.
2. Procedural Knowledge
• It is also known as imperative knowledge.
• Procedural knowledge is a type of knowledge which is
responsible for knowing how to do something.
• It can be directly applied to any task.
• It includes rules, strategies, procedures, agendas, etc.
• Procedural knowledge depends on the task on which it
can be applied.
3. Meta-knowledge:
Knowledge about the other types of knowledge is called Meta-
knowledge.
4. Heuristic knowledge:
• Heuristic knowledge is representing knowledge of
some experts in a filed or subject.
• Heuristic knowledge is rules of thumb based on
previous experiences, awareness of approaches, and
which are good to work but not guaranteed.
5. Structural knowledge:
• Structural knowledge is basic knowledge to
problem-solving.
• It describes relationships between various
concepts such as kind of, part of, and grouping of
something.
• It describes the relationship that exists between
concepts or objects.
Let's suppose if you met some person who is speaking in a language which you
don't know, then how you will able to act on that. The same thing applies to the
intelligent behavior of the agents.
As we can see in below diagram, there is one decision maker which act by
sensing the environment and using knowledge. But if the knowledge part will not
present then, it cannot display intelligent behavior.
AI knowledge cycle:
An Artificial intelligence system has the following components for displaying intelligent
behavior:
The above diagram is showing how an AI system can interact
with the real world and what components help it to show
intelligence. The AI system has Perception component by which it
retrieves information from its environment. It can be visual, audio
or another form of sensory input. The learning component is
responsible for learning from data captured by Perception
comportment. In the complete cycle, the main components are
knowledge representation and Reasoning. These two components
are involved in showing the intelligence in machine-like humans.
These two components are independent with each other but also
coupled together. The planning and execution depend on analysis
of Knowledge representation and reasoning.
Approaches to knowledge representation:
Simple relational knowledge
Inheritable knowledge
Inferential knowledge
Procedural knowledge
1. Simple relational knowledge:
• It is the simplest way of storing facts which uses the
relational method, and each fact about a set of the
object is set out systematically in columns.
• This approach of knowledge representation is famous
in database systems where the relationship between
different entities is represented.
• This approach has little opportunity for inference
Example: The following is the simple relational knowledge
representation.

Player Weight Age

Player1 65 23

Player2 58 18

Player3 75 24
2. Inheritable knowledge:
• In the inheritable knowledge approach, all data must be stored into a hierarchy
of classes.
• All classes should be arranged in a generalized form or a hierarchal manner.
• In this approach, we apply inheritance property.
• Elements inherit values from other members of a class.
• This approach contains inheritable knowledge which shows a relation between
instance and class, and it is called instance relation.
• Every individual frame can represent the collection of attributes and its value.
• In this approach, objects and values are represented in Boxed nodes.
• We use Arrows which point from objects to their values.
3. Inferential knowledge
• Inferential knowledge approach represents knowledge in the form of formal
logics.
• This approach can be used to derive more facts.
• It guaranteed correctness.
Example: Let's suppose there are two statements:
Marcus is a man
All men are mortal
Then it can represent as;

man(Marcus)
∀x = man (x) ----------> mortal (x)s
4. Procedural knowledge:
• Procedural knowledge approach uses small programs and codes
which describes how to do specific things, and how to proceed.
• In this approach, one important rule is used which is If-Then rule.
• In this knowledge, we can use various coding languages such
as LISP language and Prolog language.
• We can easily represent heuristic or domain-specific knowledge
using this approach.
• But it is not necessary that we can represent all cases in this
approach.
Requirements for knowledge Representation system:
A good knowledge representation system must possess the following
properties.
• Representational Accuracy: KR system should have the ability to represent
all kind of required knowledge.
• Inferential Adequacy:KR system should have ability to manipulate the
representational structures to produce new knowledge corresponding to the
existing structure.
• Inferential Efficiency:The ability to direct the inferential knowledge
mechanism into the most productive directions by storing appropriate
guides.
• Acquisitional efficiency- The ability to acquire new knowledge easily using
automatic methods.
Techniques of knowledge representation
There are mainly four ways of knowledge representation which are given as
follows:
1.Logical Representation
2.Semantic Network Representation
3.Frame Representation
4.Production Rules
1. Logical Representation
• Logical representation is a language with some concrete rules which
deals with propositions and has no ambiguity in representation.
Logical representation means drawing a conclusion based on various
conditions.
• This representation lays down some important communication rules. It
consists of precisely defined syntax and semantics which supports the
sound inference.
• Each sentence can be translated into logics using syntax and
semantics.
Syntax:
•Syntaxes are the rules which decide how we can construct
legal sentences in the logic.
•It determines which symbol we can use in knowledge
representation.
•How to write those symbols.
Logical representation can be categorized into mainly
two logics:
1.Propositional Logics
2.Predicate logics
Advantages of logical representation:
• Logical representation enables us to do logical
reasoning.
• Logical representation is the basis for the
programming languages.
Disadvantages of logical Representation:
• Logical representations have some restrictions and are
challenging to work with.
• Logical representation technique may not be very
natural, and inference may not be so efficient.
Semantics:

• Semantics are the rules by which we can


interpret the sentence in the logic.
• Semantic also involves assigning a meaning
to each sentence.
2. Semantic Network Representation
• Semantic networks are alternative of predicate logic for knowledge
representation.
• In Semantic networks, we can represent our knowledge in the form
of graphical networks.
• This network consists of nodes representing objects and arcs which
describe the relationship between those objects.
• Semantic networks can categorize the object in different forms and
can also link those objects.
• Semantic networks are easy to understand and can be easily
extended.
This representation consists of mainly two types of relations:

1.IS-A relation (Inheritance)

2.Kind-of-relation
Example: Following are some statements which we need to represent in
the form of nodes and arcs.
Statements:
1.Jerry is a cat.
2.Jerry is a mammal
3.Jerry is owned by Priya.
4.Jerry is white colored.
5.All Mammals are animal.

In the above diagram, we have represented the different type of knowledge in


the form of nodes and arcs. Each object is connected with another object by
some relation.
Drawbacks in Semantic representation:
• Semantic networks take more computational time at runtime as we need to
traverse the complete network tree to answer some questions. It might be
possible in the worst case scenario that after traversing the entire tree, we find
that the solution does not exist in this network.
• Semantic networks try to model human-like memory (Which has 1015
neurons and links) to store the information, but in practice, it is not possible
to build such a vast semantic network.
• These types of representations are inadequate as they do not have any
equivalent quantifier, e.g., for all, for some, none, etc.
• Semantic networks do not have any standard definition for the link names.
• These networks are not intelligent and depend on the creator of the system.
Advantages of Semantic network:
• Semantic networks are a natural representation of
knowledge.
• Semantic networks convey meaning in a
transparent manner.
• These networks are simple and easily
understandable.
3. Frame Representation
• A frame is a record like structure which consists of a
collection of attributes and its values to describe an
entity in the world.
• Frames are the AI data structure which divides
knowledge into substructures by representing
stereotypes situations.
• It consists of a collection of slots and slot values. These
slots may be of any type and sizes. Slots have names and
values which are called facets.
Facets: The various aspects of a slot is known as Facets. Facets are
features of frames which enable us to put constraints on the frames.

Example:
IF-NEEDED facts are called when data of any particular slot is needed.

A frame may consist of any number of slots, and a slot may include any
number of facets and facets may have any number of values.
A frame is also known as slot-filter knowledge
representation in artificial intelligence.
Frames are derived from semantic networks and later
evolved into our modern-day classes and objects.

A single frame is not much useful. Frames system consist


of a collection of frames which are connected. In the frame,
knowledge about an object or event can be stored together
in the knowledge base. The frame is a type of technology
which is widely used in various applications including
Natural language processing and machine visions.
Example: 1
Let's take an example of a frame for a book

Slots Filters
Title Artificial Intelligence
Genre Computer Science
Author Peter Norvig
Edition Third Edition
Year 1996
Page 1152
Advantages of frame representation:
• The frame knowledge representation makes the programming
easier by grouping the related data.
• The frame representation is comparably flexible and used by
many applications in AI.
• It is very easy to add slots for new attribute and relations.
• It is easy to include default data and to search for missing values.
• Frame representation is easy to understand and visualize.
Disadvantages of frame representation:
• In frame system inference mechanism is not be easily
processed.
• Inference mechanism cannot be smoothly proceeded
by frame representation.
• Frame representation has a much generalized
approach.
4. Production Rules
Production rules system consist of (condition, action)
pairs which mean, "If condition then action".
It has mainly three parts:
• The set of production rules
• Working Memory
• The recognize-act-cycle
The set of production rules
• In production rules agent checks for the condition
and if the condition exists then the production rule
fires and corresponding action is carried out.
• The condition part of the rule determines which rule
may be applied to a problem. And the action part
carries out the associated problem-solving steps.
• This complete process is called a recognize-act
cycle.
Working Memory
The working memory contains the description of the current state of
problem-solving and rules that can write knowledge to the working
memory. This knowledge match and may fire other rules.
• If there is a new situation (state) generates, then
multiple production rules will be fired together, this is
called conflict set.
• In this situation, the agent needs to select a rule from
these sets, and it is called a conflict resolution.
Example:
•IF (at bus stop AND bus arrives) THEN action (get into the bus)
•IF (on the bus AND paid AND empty seat) THEN action (sit down).
•IF (on bus AND unpaid) THEN action (pay charges).
•IF (bus arrives at destination) THEN action (get down from the bus).
Advantages of Production rule:
• The production rules are expressed in natural language.
• The production rules are highly modular, so we can easily
remove, add or modify an individual rule.
Disadvantages of Production rule:
• Production rule system does not exhibit any learning
capabilities, as it does not store the result of the
problem for the future uses.
• During the execution of the program, many rules may
be active hence rule-based production systems are
inefficient.

You might also like