Вы находитесь на странице: 1из 27

Artificial Intelligence

Knowledge Representation
Techniques
By

Prof. Dr. Shaiq Haq

Mechatronics Engineering, Air University, Islamabad


Agenda (Knowledge Representation)
n What is Knowledge ?
n Knowledge Representing Methods
u logic (propositional, predicate, first order, temporal, fuzzy)

u production rules

u semantic nets

u frames

u O-A-V triplets

u lists, decision tables, decision trees

u scripts

n Why use knowledge representation languages


Knowledge Pyramid
META Knowledge –
knowledge about Meta-
how to use
knowledge Knowledge

Information

Data

Noise
Stages of Knowledge
1. Acquisition
u structure of facts
u integration of old & new knowledge
2. Retrieval (recall)
u chunking of data and searching
3. Reasoning (various types)
u Deduction - formal reasoning; theorem proving
u procedural reasoning – Expert System
u Induction - reasoning by analogy (very hard for
machines), reasoning from examples
u abstraction – simplification
Logic Representation
n Logic Representation is the most common method of
representing knowledge.
n Logic is language like representation of knowledge. Usually
its statements are built up of two parts;
u premises: information and observations

u inferences: conclusions drawn from premises

n There are various types of Logic Representation;


u Propositional Logic (symbolic representation)

u Predicate Logic (language like representation)

u First order logic (a mix of Propositional and Predicate)

u Temporal Logic

u Fuzzy Logic
Propositional Logic
n A proposition is a statement that is either true or false
n A string of symbols separated by conjunctions (AND),
disjunctions (OR) negations (NOT). Propositional Logic
assumes that knowledge contains only facts.
n once the truth of a statement is known, it becomes a
premise that can be used to derive new propositions or
inferences
n Logic Symbols or connectives used in propositional logic
are shown as:
∧ (and)
∨ (or)
¬ (not)
⇒ (implication) if-then
⇔ (equivalence)
∀ (for all)
∃ (there exists)
Propositional Logic: Syntax
n Symbols (e.g., letters, words) are used to represent facts
about the world, e.g.,
u “ P” represents the fact “ Ali likes chocolate”

u “ Q” represents the fact “ Ali has chocolate”

n These are called atomic propositions


n Logical connectives are used to represent and: ∧, or: ∨ , if-
then: ⇒, not: ¬.
n Statements or sentences in the language are constructed
from atomic propositions and logical connectives.
u P ∧ ¬Q “ Ali likes chocolate and he doesn’t have any.”

u P ⇒Q “ If Ali likes chocolate then Ali has chocolate”


Predicate Logic
n Language like representation of knowledge that facilitates
inference using predicate calculus.
n uses the same concept and rules as propositional logic.
Assumes the world contains only objects and relationships.
n can be broken down into an object, a characteristic of the
object, or an assertion about the object
t likes(arshad, books)
t likes(ali , chocolates) ^ does_not_have(ali, chocolates)
n The trouble with propositional logic is that it is not possible
to write general statements in it, such as “Arshad eats
everything that he likes”. We'd have to have lots of rules,
for every different thing that Arshad liked. Predicate logic
makes such general statements possible.
First Order Logic
n A mix of Propositional Logic and
Predicate Logic

n Examples:
n ∀x At(x,AU) ∧ Smart(x) means
“Everyone is at AU and everyone is
smart”
n ∃x At(x,AU) ∧ Smart(x) means
“Someone at AU is smart”
Other Logic Types
n Temporal Logic
u Allows time-based description of facts and
knowledge.

n Fuzzy Logic
u It is a multi-valued logic based on set theory.
u In Fuzzy Logic the answer can be other than
‘0’ or ‘1’.
u It assigns likelihood to facts, instead of only yes
or no.
Production Rules
n with production rules, knowledge is represented in
condition -action pairs
u IF this condition THEN some action will occur

n each production rule implements an autonomous


piece of expertise
n in practice, knowledge-based rules are not
independent
n declarative rules state facts and relationships
n procedural rules advise how to solve a problem
Production Rules
n frequently used to formulate the knowledge in
expert systems
n formal variation is Backus-Naur form (BNF)
u metalanguage for the definition of language
syntax
u a grammar is a complete, unambiguous set of
production rules for a specific language
u a parse tree is a graphic representation of a
sentence in that language
u provide only a syntactic description of the
language
Advantages of Rules
n Rules are simple and easy to understand
n straightforward implementation in
computers is possible
n inference and explanations are easily derived
n formal foundations for some variants
n modifications are relatively easy
n it is easy to combine uncertainty with the
rules
n each rule is usually independent of the others
Limitations of Rules
n complex knowledge will require many rules,
creating problems in using and maintaining
the system. Large sets of rules become
difficult to understand and maintain
n some types of knowledge are not easily
expressed in such rules
n simple implementations are very inefficient
n because they are easy to use, KEs may try to
enforce all the knowledge into rules rather
than using a more appropriate representation
Uncertainty & Confidence Factor
n Assuming that any rule will be either true or
false is a bit artificial; human knowledge is
often inexact
n some concepts that must be represented are
relative (inexact) rather than absolute
n another source of uncertainty is when a user
cannot provide a definite answer
n imprecise and incomplete information are
other sources of uncertainty
Semantic Nets
n semantic nets are graphical depictions of
knowledge. It is composed of nodes and
links (arcs) that show hierarchical
relationships between objects

n because of their hierarchical nature, and their


ability to represent class relationships; e.g
has, is-a etc., semantic nets can show
inheritance
Semantic Net Example

lives in pine
Mini nest
tree

fly is a in
can
are endan- Wang’s
robin
have gered yard

wings is a protected
by

bird govern-
ment
Semantic Nets Problems
n Semantic nets are fine at representing
relationships between two objects but for
relationship with more than two objects it
can not represent the relationship.
n For example we want to represent the fact
that “John gives Mary the book” This might
be represented in logic as;
gives(john, mary, book1)
n Graphical representation can be very large
for complex problems.
Semantic Nets Problems (cont)
n expressiveness
u no internal structure of nodes

u relationships between multiple nodes is not possible

u no easy way to represent heuristic information

u extensions are possible, but cumbersome

u best suited for binary relationships

n efficiency
u may result in large sets of nodes and links

u search may lead to combinatorial explosion

t especially for queries with negative results

n usability
u lack of standards for link types

u naming of nodes

t classes, instances
Frames
n a frame includes all the knowledge about an object
n the knowledge in a frame is divided into slots
u a slot can describe declarative or procedural
knowledge
u each slot contains one or more facets

u facets describe some knowledge or procedures


about the attribute in the slot
t values
t default
t range
t action
n frames support the inheritance of information
Frame Example

Bird Frame Government Protected Frame


Families: Robin Endangered species: robins, eagles

Robin Frame
is a: Bird
is an: Endangered species
fly: Yes
wings Yes

instance of
Facet
Mini: instance frame location: pine tree
is a: robin
lives in: nest
Facet
location: Wang’s yard
Objects, Attribute, and Values
n using O-A-V triplets is a common way to
represent knowledge
n objects may be physical or conceptual
n attributes are the characteristics of the
objects
n values are specific measures of the attributes

Lake temperature 53 - 82 degrees F


depth 1 - 33 feet
Object Attribute Value
Lists, Tables, and Trees
n a list is a series of related items
u represents groups or classes of similar items

n a decision table is organised in columns and rows


u there are two parts: a list of attributes, and for
each attribute, a list of all possible values
u different configurations of attributes are
matched to conclusions
n a decision tree is a hierarchical representation of
knowledge relationships
u can simplify the knowledge acquisition process
Scripts
n a script describes a sequence of events
n elements of a script may include:
u entry conditions- situations that must be
satisfied before the events in the script can occur
u props- objects that are used in the script’s events

u roles - the people involved in the script

u tracks- variations that may occur in the script

u scenes - the actual sequence of events

u useful in capturing everyday, stereotypical


situations and events
Script Example

Place: Self-service place for food, etc.


Roles: Customer
Cashier
Entry conditions: Customer needs supplies
Customer has money
Supermarket has supplies
Props: Shopping carts
Shopping bags
Counters
Money
Supplies
Scene 1: Entry
Customer parks car
Customer enters supermarket
Customer gets shopping cart
Scene 2: Shopping
Comparison of KR Approaches
n So far we have discussed three KR approaches
structured objects, logic, and rules.
n Structured objects are useful for representing
declarative information about collections of related
objects/concepts, and in particular where there is a
clear class hierarchy.
n Structured objects are no good if you want to draw
a wide range of different sorts of inferences, maybe
using IF-THEN rules. For this you could use a
logic -based approach, or you could use a rule -
based system.
KR Languages and Programming
Languages
n how is a knowledge representation language
different from a programming language (e.g. Java,
C++)?
u programming languages can be used to express
facts and states
n what about "there is a pit in [2,2] or [3,1] (but we
don't know for sure)" or "there is a wumpus in
some square"
n programming languages are not expressive enough
for situations with incomplete information
u we only know some possibilities which exist

Вам также может понравиться