Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

ARTIFICIAL INTELLIGENCE

for
T.E. Computer Engg. / I. T

As per Revised KBCNMU Syllabus (w.e.f. 2019-2020)

Notes prepared by:


Mr. Pravin K. Patil
Assistant Professor, Computer Engineering Department

SSBT‟s College of Engineering and Technology Bambhori Jalgaon

Based on Reference Book:

Elaine Rich, Kevin Knight and Shivshankar Nair "Artificial Intelligence".


3rd Edition TMH.
UNIT – II
KNOWLEDGE ENGINEERING
Contents:
 Knowledge Representation Issues
 Knowledge Representation using Predicate Logic
 Knowledge Representation using Rules
 Weak and Strong Filler Structure for Knowledge Representation
o Semantic Net
o Frames
o Script
o Conceptual Dependency

Knowledge Representation Issues


 The fundamental goal of Knowledge Representation is to facilitate inference
(conclusions) from knowledge.
 The issues that arise while using KR techniques are many. Some of these are
explained below.

1. Important Attributes :
 Any attribute of objects so basic that they occur in almost every problem
domain?
2. Relationship among attributes:
 Any important relationship that exists among object attributes?
3. Choosing Granularity:
 At what level of detail should the knowledge be represented?
4. Set of objects:
 How sets of objects be represented?
5. Finding Right structure :
 Given a large amount of knowledge stored, how can relevant parts are
accessed?

1. Important Attributes :
 There are attributes that are of general significance.
 There are two attributes "instance" and "isa” that are of general importance.
 These attributes are important because they support property inheritance.
 “ IsA ” and “ Instance ”

 Two important attributes "instance" and "isa", in a hierarchical structure


 These two attributes support property inheritance and play important role
in knowledge representation.
 The ways, attributes "instance" and "isa", are logically expressed are :
 Example: A simple sentence like "Joe is a musician“

Here "is a" (called IsA) is a way of expressing what logically is called a
class-instance relationship between the subjects represented by the terms "Joe" and
"musician".

"Joe" is an instance of the class of things called "musician".

"Joe" plays the role of instance,

"Musician" plays the role of class in that sentence.

Here,

[Joe] IsA [Musician]

i.e., [Instance] IsA [Class]

2. Relationship among Attributes


 The attributes to describe objects are themselves entities they represent.
 The relationship between the attributes of an object, independent of specific
knowledge they encode, may hold properties like:
a. Inverses
b. An Isa hierarchy of Attributes
c. Techniques for reasoning about values
d. Single valued attributes.

a. Inverses:
 This is about consistency check, while a value is added to one attribute. The
entities are related to each other in many different ways. The below figure
shows attributes (isa, instance, and team), each with a directed arrow,
originating at the object being described and terminating either at the object or
its value.
There are two ways of realizing this:
 First, represent two relationships in a single representation; e.g., a logical
representation, team (Pee-Wee-Reese, Brooklyn–Dodgers), that can be
interpreted as a statement about Pee-Wee-Reese or Brooklyn–Dodger.
 Use attributes that focus on a single entity but use them in pairs, one the
inverse of the other. For e.g., one Dodgers and the other team = Pee-Wee-
Reese,
 This second approach is followed in semantic net and frame-based systems,
accompanied by a knowledge acquisition tool that guarantees the consistency
of inverse slot by checking, each time a value is added to one attribute then the
corresponding value is added to the inverse.

b. An IsA hierarchy of Attributes


 Just like there are classes of objects and specialized subset of classes,
similarly, there are attributes and specialization of the attributes.
 For e.g. the attribute height is a specialized attribute of the general attribute
physical – size.
 This specialization – generalization relationship among the attributes is
important for the purpose of inheritance.

c. Techniques for reasoning about values


 Sometimes, values of the attributes are explicitly specified when the
knowledge base is created.
 But there are also values of the attributes that are not given explicitly.
 This decision making process of deciding whether the values of the attributes
are to be specified explicitly or not is known as a Reasoning System.
 Following is the different types of information that plays a major role in this
Reasoning System:
o Information about type of value. For e.g. the value of the attribute
height must be a number measured in the units of length.
o Constraints on value. For e.g. age of a person cannot be greater than
the age of his / her parents.
o Rules of computing the value when it is needed. For e.g. in the above
figure, the value of the attribute bats will be computed only if its
needed.
o Rules that describe the action to be taken if the value of the attribute is
ever known.

d. Single Valued Attributes


 A specific but a very useful kind of attribute is the one that is guaranteed to
take unique values. For e.g. a baseball player can, at one time, have a single
height and can be a member of only one team. So the attribute height and
team are called as single valued attribute.

3. Choosing the Granularity


 While deciding the granularity of representation, it is necessary to know the
following:
a) What are the primitives and at what level should the knowledge be
represented?
b) What should be the number (small or large) of low-level primitives or
high-level facts?
 High-level facts may be insufficient to draw the conclusion while Low-level
primitives may require a lot of storage.
 Example: Suppose that we are interested in following facts:
John spotted Alex.
 Now, this could be represented as
"Spotted (agent (John), object (Alex))"
 Such a representation can make it easy to answer questions such as:
Who spotted Alex?
 Suppose we want to know :
"Did John see Alex?"
 Given only one fact, user cannot discover that answer.
 Hence, the user can add other facts, such as
"Spotted (x, y) → saw (x, y)"
4. Set of Objects
 Certain properties of objects that are true as member of a set but not
as individual
 Example: Consider the assertion made in the sentences
There are more sheep than people in Australia,
and
English speakers can be found all over the world.
 To describe these facts, the only way is to attach assertion to the sets
representing People, Sheep, and English.
 The reason to represent sets of objects is if a property is true for all or most
elements of a set, then it is more efficient to associate it once with the set rather
than to associate it explicitly with every elements of the set.
 This is done in different ways :
 In logical representation through the use of universal quantifier, and
 In hierarchical structure where node represents sets, the
inheritance propagates set level assertion down to individual.

5. Finding the right Structure


 It is generally accessing the right structure for describing a particular situation.
 It requires, selecting an initial structure and then revising the choice. While doing
so, it is necessary to solve following problems:
a) How to perform an initial selection of the most appropriate structure.
b) How to fill in appropriate details from the current situations.
c) How to find a better structure if the one chosen initially turns out not to be
appropriate.
d) What to do if none of the available structures is appropriate.
e) what to do if none of the available structures is appropriate

Q. Discuss knowledge representation issues in detail (KBCNMU December 2019 Examination)

Knowledge Representation using Predicate Logic


 Predicate logic is one of the knowledge representation schemes that satisfy the
requirements of any language.
 Predicate logic is powerful enough for expression and reasoning.
 Every complete sentence contains two parts:
1. Subject - The subject is what (or whom) the sentence is about.
2. Predicate - The predicate tells something about the subject
 Example: Judy {runs}
 Here Judy is the Subject and runs is the Predicate.
 Predicate, always includes verb, tells something about the subject
 Predicate is a verb phrase template that describes a property of objects, or a relation
among objects represented by the variables.
 Example:
“The car Tom is driving is blue"
"The sky is blue"
"The cover of this book is blue"
 Predicate is blue describes property.
 Predicates can be given names;
 Let „B‟ is name for predicate "is_blue".
 Sentence is represented as "B(x)”, read as "x is blue" where, “x” represents an
arbitrary object.

Knowledge Representation using Rules



The other most popular approach to Knowledge representation is to use production
rules, sometimes called IF-THEN rules.
 The production rules are simple but powerful forms of knowledge representation
providing the flexibility of combining declarative and procedural representation for
using them in a unified form.
 Examples of production rules :
− IF condition THEN action
− IF premise THEN conclusion
− IF proposition p1 and proposition p2 are true THEN proposition p3
is true
 The advantages of production rules :
o They are modular,
o Each rule define a small and independent piece of knowledge
o New rules may be added and old ones deleted
o Rules are usually independently of other rules.
 The production rules as knowledge representation mechanism are used in the design
of many "Rule-based systems” also called "Production systems" .
 Reasoning/Chaining
 Rule-Based system architecture consists a set of rules, a set of facts, and an
inference engine. The need is to find what new facts can be derived.
 It is the process to solve the problem from initial state to goal state.
 Given a set of rules, there are essentially two ways to generate new
knowledge:
1. Forward chaining
2. Backward chaining.
1. Forward chaining :
 It is also called data driven.
 It starts with the facts, and sees what rules apply.
 It starts from initial to goal state.
 Condition rules represent actions to be taken when specified facts
occur in working memory.
 Typically, actions involve adding or deleting facts from the working
memory.

Facts
Working Inference
Engine Engine
Facts
Facts Rule

User Rule Based

Fig. Forward chaining

2. Backward chaining :
 It is also called goal driven.
 It starts with something to find out, and looks for rules that will help in
answering it.
 It starts from Goal back to Initial state
 Backward chaining means reasoning from goals back to facts.
 The idea is to focus on the search.
 Rules and facts are processed using backward chaining interpreter.
Weak and Strong Filler Structure for Knowledge Representation

1. Semantic Nets
 "Semantic Nets" were first invented for computers by Richard H. Richens of
the Cambridge Language Research Unit in 1956
 A semantic network, or frame network, is a network that represents semantic relations
between concepts.
 This is often used as a form of knowledge representation.
 It is a directed or undirected graph consisting of vertices, which represent concepts,
and edges, which represent semantic relations between concepts.
 It is used to analysing meaning of words within sentence.
 It is graphically shown in the form of directed graph consisting of nodes and arcs.
 The nodes represent objects and arcs represent links or edges.
 Semantic networks are an alternative to predicate logic as a form of knowledge
representation.
 The idea is that we can store our knowledge in the form of a graph, with nodes
representing objects in the world, and arcs representing relationships between those
objects.
 Example
 The above figure represents the following data:
o Tom is a cat.
o Tom caught a bird.
o Tom is owned by John.
o Tom is ginger in colour.
o Cats like cream.
o The cat sat on the mat.
o A cat is a mammal.
o A bird is an animal.
o All mammals are animals.
o Mammals have fur

 Advantages of Semantic Nets


1. Semantic networks are a natural representation of knowledge.
2. Semantic networks convey meaning in a transparent manner.
3. These networks are simple and easily understandable.

 Disadvantages of Semantic Nets


1. 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.
2. 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.
3. These types of representations are inadequate as they do not have any equivalent
quantifier, e.g., for all, for some, none, etc.
4. Semantic networks do not have any standard definition for the link names.
5. These networks are not intelligent and depend on the creator of the system.

Q. Write a short note on Semantic Nets (KBCNMU December 2019 Examination)

2. Frames
 Frames were proposed by Marvin Minsky in 1974 article "A Framework for
Representing Knowledge."
 Frames were originally derived from semantic networks and are therefore part of
structure based knowledge representations.
 Frame is a collection of attributes and associated values that describe some entity in
the world.
 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.
 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 a 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 consists 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
 Let's suppose we are taking an entity, Peter. Peter is an engineer as a profession, and
his age is 25, he lives in city London, and the country is England. So following is the
frame representation for this:

Slots Filter

Name Peter

Profession Doctor

Age 25

Marital status Single

Weight 78
 Advantages of frame representation:
1. The frame knowledge representation makes the programming easier by grouping the
related data.
2. The frame representation is comparably flexible and used by many applications in AI.
3. It is very easy to add slots for new attribute and relations.
4. It is easy to include default data and to search for missing values.
5. Frame representation is easy to understand and visualize.

 Disadvantages of frame representation:


1. In frame system inference mechanism is not be easily processed.
2. Inference mechanism cannot be smoothly proceeded by frame representation.
3. Frame representation has a much generalized approach.

Q. Write a short note on Frames (KBCNMU December 2019 Examination)

3. Conceptual Dependency(CD)
 CD theory was developed by Schank in 1973 to 1975 to represent the meaning of
Natural Language sentences.
 It helps in drawing inferences
 It is independent of the language
 CD representation of a sentence is not built using words in the sentence rather built
using conceptual primitives which give the intended meanings of words.
 CD provides structures and specific set of primitives from which representation can
be built.
 Conceptual dependency (CD) is a theory of natural language processing which mainly
deals with representation of semantics of a language.
 It helps to construct computer programs which can understand natural language.
 It helps to make inferences from the statements and also to identify conditions in
which two sentences can have similar meaning,
 It provide facilities for the system to take part in dialogues and answer questions,
 To provide a means of representation which are language independent.
 Knowledge is represented in CD by elements what are called as conceptual structures.
 What forms the basis of CD representation is that for two sentences which have
identical meaning there must be only one representation and implicitly packed
information must be explicitly stated.
 In order that knowledge is represented in CD form, certain primitive actions have
been developed.
Table: Primitive Acts of CD

Symbol Meaning Example

ATRANS transfer a relationship give

PTRANS transfer physical location of an object go

PROPEL apply physical force to an object push

MOVE move body part by owner kick

GRASP grab an object by an actor grasp

INGEST ingest an object by an animal eat

EXPEL expel from an animal’s body Cry

MTRANS transfer mental information Tell

MBUILD mentally make new information Decide

CONC conceptualize or think about an idea think

SPEAK produce sound say

ATTEND focus sense organ listen

 Few conventions:
o Arrows indicate directions of dependency
o Double arrow indicates two way link between actor and action.
o O – for the object case relation
o R – for the recipient case relation
o P – for past tense
o D – destination
 Examples of Conceptual Dependency

Sentences CD Representations
p o d ?
Jenny cried Jenny  EXPEL  tears
eyes
poss-by 
Jenny

p d India
Mike went to India Mike  PTRANS
? (source is unknown)
Mary read a novel p o d CP(Mary)
Mary  MTRANS  info
novel
 i (instrument)

p o d novel
Mary  ATTEND  eyes
?

Q. Explain Conceptual Dependency with various primitives and show conceptual dependency
relation for the following- 1. Seema is a teacher 2. A nice flower (KBCNMU December 2019
Examination)

4. Script
 Script was developed by Schank and Abelson, 1977
 A script is a structured representation describing a stereotyped sequence of events in a
particular context.
 Scripts are used in natural language understanding systems to organize a knowledge
base in terms of the situations that the system should understand
 A script is a structure that prescribes a set of circumstances which could be expected
to follow on from one another.
 It is similar to a thought sequence or a chain of situations which could be anticipated.
 It could be considered to consist of a number of slots or frames but with more
specialised roles.
 Scripts are beneficial because:
 Events tend to occur in known runs or patterns.
 Causal relationships between events exist.
 Entry conditions exist which allow an event to take place
 Prerequisites exist upon events taking place. E.g. when a student progresses
through a degree scheme or when a purchaser buys a house.
 The components of a script include:
 Entry Conditions: These must be satisfied before events in the script can
occur.
 Results: Conditions that will be true after events in script occur.
 Props: Slots representing objects involved in events.
 Roles: Persons involved in the events.
 Track: Variations on the script. Different tracks may share components of the
same script.
 Scenes: The sequence of events that occur. Events are represented
in conceptual dependency form
 Example: Script for Bank Robbery
 Example: Script for Restaurant

Q. What is Script? Write Script for Banking with components(KBCNMU December 2019
Examination)

You might also like