K K Knowledge Knowledge l d l d Representation Representation - - PowerPoint PPT Presentation
K K Knowledge Knowledge l d l d Representation Representation - - PowerPoint PPT Presentation
K K Knowledge Knowledge l d l d Representation Representation Representation Representation Chapter 3 Chapter 3 Dr Ahmed Rafea Dr Ahmed Rafea Dr Ahmed Rafea Dr Ahmed Rafea Introduction Introduction Introduction Introduction In
Introduction Introduction Introduction Introduction
In this chapter we will explore some techniques
In this chapter we will explore some techniques In this chapter we will explore some techniques In this chapter we will explore some techniques used to represent domain knowledge in AI used to represent domain knowledge in AI programs programs p g p g
We will describe :
We will describe :
procedural and declarative knowledge representation
procedural and declarative knowledge representation p g p p g p
propositional and predicate logic
propositional and predicate logic
Frames, semantic
Frames, semantic nets nets
Representing Uncertainty
Representing Uncertainty
Building a Knowledge Base
Building a Knowledge Base
Knowledge Representation Knowledge Representation
What is knowledge?
What is knowledge?
Knowledge is the fact or condition of being aware of
Knowledge is the fact or condition of being aware of g g g g something something
What is knowledge representation?
What is knowledge representation?
It is the problem of storing knowledge in a computer
It is the problem of storing knowledge in a computer
Programmers use symbols to represent knowledge in
Programmers use symbols to represent knowledge in Thi i ll d i l i f h Thi i ll d i l i f h
- computers. This is called internal representation of the
- computers. This is called internal representation of the
knowledge knowledge K l d i i l d ff b K l d i i l d ff b
Knowledge representation involves tradeoffs between
Knowledge representation involves tradeoffs between the needs of people and computers. It must be easy to the needs of people and computers. It must be easy to use easy to understand modify and extend use easy to understand modify and extend use, easy to understand, modify, and extend use, easy to understand, modify, and extend
Procedural Representation Procedural Representation
It is the most common technique for representing
It is the most common technique for representing knowledge in computers it encodes facts and knowledge in computers it encodes facts and knowledge in computers, it encodes facts and knowledge in computers, it encodes facts and defines the sequence of operations for manipulating defines the sequence of operations for manipulating these facts these facts these facts. these facts.
A program code is a natural way of encoding
A program code is a natural way of encoding d l k l d Th i ti ll d l k l d Th i ti ll procedural knowledge. The program is essentially procedural knowledge. The program is essentially
- ne big knowledge representation.
- ne big knowledge representation.
Programs written in scripting languages such as
Programs written in scripting languages such as Visual Basic and JavaScript are examples for Visual Basic and JavaScript are examples for procedural knowledge representation procedural knowledge representation
Declarative Representation Declarative Representation
However, in procedural code the knowledge and its
However, in procedural code the knowledge and its manipulation are inextricably linked. This weakness is manipulation are inextricably linked. This weakness is
- vercome by the declarative approach.
- vercome by the declarative approach.
In declarative knowledge representation, a user states facts,
In declarative knowledge representation, a user states facts, rules, and relationships. They stand by themselves and rules, and relationships. They stand by themselves and represent pure knowledge. represent pure knowledge.
Declarative representation became the most popular
Declarative representation became the most popular knowledge representation approach because the knowledge knowledge representation approach because the knowledge is explicitly represented it can be easily modified and the is explicitly represented it can be easily modified and the is explicitly represented, it can be easily modified and the is explicitly represented, it can be easily modified and the separation of the control logic and the reasoning algorithm separation of the control logic and the reasoning algorithm from the knowledge allows us to write optimized and from the knowledge allows us to write optimized and from the knowledge allows us to write optimized and from the knowledge allows us to write optimized and reusable procedures reusable procedures
Relational Representation Relational Representation Relational Representation Relational Representation
Knowledge is represented in relational form, such
Knowledge is represented in relational form, such as that used in relational database systems as that used in relational database systems
By storing a collection of information in a table we
By storing a collection of information in a table we can use relational calculus to manipulate the data, can use relational calculus to manipulate the data, based on the relations defined, and query the based on the relations defined, and query the i f i d i h bl i f i d i h bl information stored in the table. information stored in the table.
However, the relational representation are not
However, the relational representation are not d t ti l l ti hi d t ti l l ti hi good at representing complex relationships good at representing complex relationships between objects in the real world. This is where between objects in the real world. This is where network and hierarchical representations are strong network and hierarchical representations are strong network and hierarchical representations are strong network and hierarchical representations are strong
Hierarchical Representation Hierarchical Representation Hierarchical Representation Hierarchical Representation
It is the best to represent “isa” relationships, where a
It is the best to represent “isa” relationships, where a p p , p p , general or abstract type is linked to more specific types general or abstract type is linked to more specific types which inherit the basic properties of the general type which inherit the basic properties of the general type b
The strength of object inheritance allows for compact
The strength of object inheritance allows for compact representation of knowledge and allows processing at representation of knowledge and allows processing at different levels of abstraction and thus reducing different levels of abstraction and thus reducing different levels of abstraction and thus reducing different levels of abstraction and thus reducing complexity complexity
AI problem solving requires capturing knowledge about
AI problem solving requires capturing knowledge about
- bjects and about nonphysical measurements such as
- bjects and about nonphysical measurements such as
time time
Predicate Logic Predicate Logic-1 Predicate Logic Predicate Logic 1
The most basic form of logic representation is called
The most basic form of logic representation is called g p g p boolean or propositional logic, in which each boolean or propositional logic, in which each proposition is represented by a symbol that evaluates to proposition is represented by a symbol that evaluates to ith r Tr r F l ith r Tr r F l either True or False. either True or False.
Sentences are constructed using proposition symbols
Sentences are constructed using proposition symbols (P,Q,R,…) and boolean connectives such as (and, or, (P,Q,R,…) and boolean connectives such as (and, or, (P,Q,R,…) and boolean connectives such as (and, or, (P,Q,R,…) and boolean connectives such as (and, or, implication, equivalence) to give us implications or rules implication, equivalence) to give us implications or rules
Predicate logic allows predicates on objects to define
Predicate logic allows predicates on objects to define attributes and relations between objects. Using objects, attributes and relations between objects. Using objects, attributes, and relations we can represent any type of attributes, and relations we can represent any type of knowledge knowledge knowledge. knowledge.
Predicate Logic Predicate Logic-2 Predicate Logic Predicate Logic 2
A statement such as “Minnesota is cold in winter”
A statement such as “Minnesota is cold in winter” A statement such as Minnesota is cold in winter A statement such as Minnesota is cold in winter could be represented in predicate logic in several ways : could be represented in predicate logic in several ways :
We can use conjunction of functions:
We can use conjunction of functions:
place (Minnesota) and temperature (cold) and season (winter)
place (Minnesota) and temperature (cold) and season (winter)
We can use a single relation
We can use a single relation
i t (Mi t ld) i t (Mi t ld)
winter (Minnesota, cold)
winter (Minnesota, cold) There are two techniques called “ resolution” and
There are two techniques called “ resolution” and ”unification” that are used to process predicate ”unification” that are used to process predicate unification that are used to process predicate unification that are used to process predicate statements to prove whether a particular statement is statements to prove whether a particular statement is true or not based on other known facts. true or not based on other known facts.
Resolution Resolution Resolution Resolution
Resolution is an algorithm for providing facts by virtue of
Resolution is an algorithm for providing facts by virtue of contradiction contradiction
For example, suppose that we know these facts
For example, suppose that we know these facts
1-
- not feathers (tweety) or bird (tweety)
not feathers (tweety) or bird (tweety)
2-
- feathers (tweety)
feathers (tweety) ( y) ( y)
Sentence 1 states tweety doesn’t have feathers or tweety is a bird.
Sentence 1 states tweety doesn’t have feathers or tweety is a bird. Sentence 2 states that tweety has feathers. Sentence 2 states that tweety has feathers.
To prove that tweety is a bird we negate that predicate, giving
To prove that tweety is a bird we negate that predicate, giving To prove that tweety is a bird we negate that predicate, giving To prove that tweety is a bird we negate that predicate, giving sentence 3 sentence 3
3-
- not bird (tweety)
not bird (tweety)
Applying resolution on sentence 1 and 2 we get sentence 4
Applying resolution on sentence 1 and 2 we get sentence 4 pp y g eso
- o se
e ce d we ge se e ce pp y g eso
- o se
e ce d we ge se e ce
4-
- bird (tweety)
bird (tweety)
So it is clear that sentence 3 and 4 cannot be true. Thus, we have a
So it is clear that sentence 3 and 4 cannot be true. Thus, we have a
- contradiction. Which means that the assumption, not bird (tweety),
- contradiction. Which means that the assumption, not bird (tweety),
p , ( y), p , ( y), is false, and the alternative, bird (tweety), must be true is false, and the alternative, bird (tweety), must be true
Unification Unification
Unification is a technique for taking two sentences in predicate logic
Unification is a technique for taking two sentences in predicate logic and finding a substitution that makes them look the same and finding a substitution that makes them look the same
The substitution is done as follows:
The substitution is done as follows:
Variable can be replaced by a constant
Variable can be replaced by a constant
Variable can be replaced by another variable
Variable can be replaced by another variable
Variable can be replaced with a predicate not containing that variable
Variable can be replaced with a predicate not containing that variable
Having the following predicates, unification can be done as follows
Having the following predicates, unification can be done as follows
1-
- Hates (x, y)
Hates (x, y)
2-
- Hates (George, broccoli)
Hates (George, broccoli)
We can unify sentence 2 with 1 by binding George to variable x and
We can unify sentence 2 with 1 by binding George to variable x and broccoli to y broccoli to y
A generalized version of the unification algorithm, called match, is
A generalized version of the unification algorithm, called match, is used in Prolog. Facts are represented in Prolog by clauses, which used in Prolog. Facts are represented in Prolog by clauses, which look like standard predicates and declare things which are look like standard predicates and declare things which are diti ll t diti ll t unconditionally true unconditionally true
Frames Frames
A frame is a collection of attributes that define the state of
A frame is a collection of attributes that define the state of an object and its relationship to other frames (objects) an object and its relationship to other frames (objects) j p ( j ) j p ( j )
In AI, frames are called slot
In AI, frames are called slot-
- and
and-
- filter data representations
filter data representations
If a sequence of actions is applied to a frame, then some of
If a sequence of actions is applied to a frame, then some of h ib h hil i h h ib h hil i h the attributes change while most remain the same the attributes change while most remain the same
A memory problem, called the frame problem, may occur
A memory problem, called the frame problem, may occur if we copy the complete frame for each step in the if we copy the complete frame for each step in the py p p py p p sequence of a search algorithm sequence of a search algorithm
The frame problem addresses the issue of which attributes
The frame problem addresses the issue of which attributes in the frame should change The solution is to specify the in the frame should change The solution is to specify the in the frame should change. The solution is to specify the in the frame should change. The solution is to specify the parts of the state that must match for a condition to be parts of the state that must match for a condition to be true, and only change those attributes that change as a true, and only change those attributes that change as a lt f t lt f t result of an operator result of an operator
Example Example
f f f b f f f f b f
This is an example of a frame representation for a subset of
This is an example of a frame representation for a subset of the domain of vehicles the domain of vehicles
Semantic Nets Semantic Nets Semantic Nets Semantic Nets
They are nets used to define the meaning of a
They are nets used to define the meaning of a
They are nets used to define the meaning of a
They are nets used to define the meaning of a concept by its relationships to other concepts. concept by its relationships to other concepts.
A graph data structure is used with nodes
A graph data structure is used with nodes
A graph data structure is used, with nodes
A graph data structure is used, with nodes holding concepts and links with natural language holding concepts and links with natural language labels showing the relationships labels showing the relationships labels showing the relationships. labels showing the relationships.
A portion of a semantic net representation of
A portion of a semantic net representation of h hi l d i i h i h f ll i h hi l d i i h i h f ll i the vehicle domain is shown in the following the vehicle domain is shown in the following figure figure
Representing Uncertainty Representing Uncertainty
In all real world applications, a reasoning system will not
In all real world applications, a reasoning system will not have all the information needed to solve the problem have all the information needed to solve the problem a have all the information needed to solve the problem have all the information needed to solve the problem a a priori
- priori. We have uncertainty
. We have uncertainty
There will be some information available, but the rest will
There will be some information available, but the rest will h b i f d h i f i d h b i f d h i f i d have to be inferred as the inferencing proceeds. have to be inferred as the inferencing proceeds.
A theory called Bayes’ Theorem works well under
A theory called Bayes’ Theorem works well under conditions of uncertainty. conditions of uncertainty. y
It states that we can compute conditional probability that
It states that we can compute conditional probability that event Y will occur given that event X already occurred, event Y will occur given that event X already occurred, providing we have the prior probabilities that X and Y providing we have the prior probabilities that X and Y providing we have the prior probabilities that X and Y providing we have the prior probabilities that X and Y could happen, and the conditional probability that X will could happen, and the conditional probability that X will
- ccur when we know that Y has already occurred
- ccur when we know that Y has already occurred
P(Y|X) P(X|Y) [ P(Y) / P(X)] P(Y|X) P(X|Y) [ P(Y) / P(X)]
P(Y|X) = P(X|Y) [ P(Y) / P(X)]
P(Y|X) = P(X|Y) [ P(Y) / P(X)]
Building a Knowledge base Building a Knowledge base
Now after we have described many types of knowledge, we need to
Now after we have described many types of knowledge, we need to group it all in one place, in our knowledge base group it all in one place, in our knowledge base
The knowledge base is the repository of information containing the
The knowledge base is the repository of information containing the facts we know about objects and their relationships facts we know about objects and their relationships
After several years of AI research, it became clear that knowledge
After several years of AI research, it became clear that knowledge y , g y , g was the key to building successful AI system was the key to building successful AI system
By time a problem called knowledge acquisition bottleneck appeared
By time a problem called knowledge acquisition bottleneck appeared due to the fact that knowledge acquisition is difficult and costly due to the fact that knowledge acquisition is difficult and costly due to the fact that knowledge acquisition is difficult and costly due to the fact that knowledge acquisition is difficult and costly
- process. Moreover, sometimes experts weren’t so keen on having
- process. Moreover, sometimes experts weren’t so keen on having
their expertise turned into a computer application or sometimes they their expertise turned into a computer application or sometimes they couldn’t explain “how” they came up with those insights or finally couldn’t explain “how” they came up with those insights or finally couldn t explain how they came up with those insights or finally couldn t explain how they came up with those insights or finally they may not have the time to talk to a knowledge engineer they may not have the time to talk to a knowledge engineer
This problem can be solved by machine learning. Neural networks
This problem can be solved by machine learning. Neural networks d k l d i th i ti i ht b t d k l d i th i ti i ht b t can encode knowledge in their connection weights, but as a can encode knowledge in their connection weights, but as a knowledge representation they are a “black box.” knowledge representation they are a “black box.”