Title: Knowledge Representation
1Knowledge Representation
- Shyh-Kang Jeng
- Department of Electrical Engineering/
- Graduate Institute of Communication Engineering
- National Taiwan University
2References
- J. P. Bigus and J. Bigus, Constructing
Intelligent Agents with Java, Wiley Computer
Publishing, 1998 - S. Russell and P. Norvig, Artificial
Intelligence A Modern Approach, Englewood
Cliffs, NJ Prentice Hall, 1995
3Goal-Based Agents
Sensors
Environment
State
Environment Model
Options
Decision Maker
Goals
Agent
Effectors
4Knowledge-Based Agents
Sensors
Environment
Knowledge Base Management System
Knowledge Base
Agent
Effectors
5General Knowledge-Based Agent (1)
- class KBAgent
- KnowledgeBase kb
- KBMS kbms
- counter t // indicating time
- public KBAgent()
- kb new KnowledgeBase()
- kbms new KBMS( kb )
- t 0
-
6General Knowledge-Based Agent (2)
- public Action run(Percept percept)
- kbms.tell(new
- PerceptSentence(percept, t))
- Action action kbms.ask( new
- ActionQuery(t) )
- kbms.tell( new
- ActionSentence(action,t) )
- t return action
-
-
7Knowledge Base
- A set of representation of facts about the world
- Each individual representation is a sentence
- Sentences are expressed in a knowledge
representation language - Knowledge representation languages are composed
of symbols - Representation and reasoning support the
operation of a knowledge-based agent, accessed
through a knowledge base management system (KBMS)
8Knowledge Representation
- Natural language
- Most easily understood for people
- Not the best for computers because of ambiguity
- Formal logic was the first representation
language
9Procedural Representation
- Encodes facts and defines sequence as well as the
control structure of operations for using and
manipulating those facts - Example FORTRAN programs
- hardcoded logic
- Not considered to be part of AI per se
- Few AI programs exist which do not contain some
amount of procedural control code
10Declarative Representation
- Simply states facts, rules, and relationships
- Separate the knowledge and the manipulation of
the knowledge - Still needs to be processed by some procedural
code - More easily modified
- Allows for optimization and reuse inferencing
procedures
11Relational Representation
- Knowledge is stored in a table and manipulated
through relational calculus - Information of an item is represented by tuples
or records - Each tuple contains a set of fields or columns
defining specific attributes and values of the
item - Flexible but not good at representing complex
relationships between concepts or objects in the
real world
12Hierarchical Representation
- Represents relationships and shared attributes
between kinds or classes of objects - Use categories or types to give structure to the
world by grouping similar objects together - Allows for compact representation
- Allows reasoning algorithms to process at
different levels of abstraction or granularity
13Frames
- As a collection of attributes which defines the
state of an object and its relationship to other
frames - Also called slot-and-filler data representations
- Slots are the data values
- Fillers are attached procedures which are called
before, during, or after the slots value is
changed - Often linked to a hierarchy
14A Frame Example
isa
isa
isa
isa
isa
15Semantic Nets
- Defines the meaning of a concept by its
relationships to other concepts - Uses a graph data structure, where nodes hold
concepts and links show the relationships - Both frames and semantic nets can be transformed
to predicate logic
16A Semantic Net Example
has-part
Vehicle
Wheels
has-part
isa
has-part
Motor
Doors
Automobile
num-wheels
isa
size
4
Sports Car
Small
num-doors
2
instance
Corvette
17Knowledge Representation Language
- Syntax
- describes the possible configurations that
constitute sentences - Semantics
- determines the facts in the world to which the
sentences refer - Logic
- A language with the syntax and semantics defined
precisely
18Logics
- A logic consists of
- A formal system for describing states of affairs,
consisting of the syntax and the semantics of the
language - A proof theory
- The ontological commitments of a logic have to do
with the nature of reality in the related world - The epistemological commitments of a logic have
to do with states of knowledge an agent can have
19Propositional Logic Syntax
20Propositional Logic Semantics
- Defined by specifying the interpretation of the
symbols and constants, and specifying the
meanings of the logical connectives - A complex sentence has a meaning derived from the
meaning of its parts - Each connective can be thought of as a function
and defined by truth tables
21Truth Tables for Connectives
22Test for Valid Sentences
- A valid sentence is true for every possible
combination of truth values for the propositional
symbols in the sentence - Truth table can be used to test for valid
sentences - This can be used to determine if the conclusion
(consequent) is true given some premises
(antecedent). Just test if the following sentence
is valid -
23First-Order Logic Syntax
24Quantifiers
- Universal quantifier
- Existential quantifier
25Some Properties of Quantified Sentences
26First-Order Logic vs.Higher-Order Logic
- In first-order logic one can quantify over
objects but not over relations or functions on
those objects - Higher-order logic allows us to quantify over
relations and functions as well as over objects - Example
27Accessing First-Order Logic KB
- Assertions
- Example
- Queries or goals
- Example
- Substitution or binding list
- Example
28Sets and Lists
- Sets
- Constant EmptySet
- Predicates Set, Member, Subset
- Functions Intersection, Union, Adjoint
- Lists
- Constant Nil
- Functions Cons, Append, First, Rest
- Predicates Find, Member, List?
29Special Notations for Sets and Lists
30The Wumpus World
31Agent in the Wumpus World
- The agent starts in the lower left corner labeled
1,1, facing to the right - Goal Find the gold, return to 1,1 and climb
out of the cave as soon as possible - Actions Forward, Turn(Right), Turn(Left), Grab,
Release, Shoot, Climb - Percepts Stench, Breeze, Glitter, Bump, Scream
32Acting and Reasoning in the Wumpus World (1)
33Acting and Reasoning in the Wumpus World (2)
34Acting and Reasoning in the Wumpus World (3)
35Acting and Reasoning in the Wumpus World (4)
36Knowledge After the Third Move
37Propositional Knowledge Base After the Third Move
38Finding the Wumpus
39Problems with Propositional Agent
- Too many propositions to handle
- Example 64 propositions for the rule dont
forward if the wumpus is in front of you - Dealing with change over time
- Example
40Reflex Agent
- Action run(Percept percept)
- state
- interprete(percept)
- rule
- kbms.ruleMatch(state)
- action rule.Action()
-
41Reflex Agent for the Wumpus World (1)
- Direct rules
- Example
- Mediated rules
- Example
42Reflex Agent for the Wumpus World (2)
- Limitations
- Unable to know the states
- Example Not knowing when to climb
- Unable to avoid infinity loop
43Model-Based Agent
- Maintain an internal model of the world
- Any system that makes decisions on the basis of
past percepts can be rewritten to use instead a
set of sentences about the current world state - Example My keys are in my pocket
- Diachronic rules
- Rules describing the way in which the world
changes or does not change
44Knowledge Engineering
- Knowledge engineering
- Process of building knowledge base
- Knowledge engineer
- Knowledge acquisition
- Prior to, or interleaved with, the process of
creating formal representations
45Knowledge Engineering vs. Programming
46Knowledge Engineering Methodology
- Ontological engineering
- Decide what to talk about
- Decide on a vocabulary of predicates, functions,
and constants (ontology of the domain) - Encode general knowledge about the domain
- Encode a description of the specific problem
instance - Pose queries to the inference procedure and get
answers
47General Ontology
- Ontology
- Particular theory of the nature of being or
existence - General ontology
- Applicable in more or less any special-purpose
domain, with the addition of domain-specific
axioms - Examples Categories, measures, composite
objects, time, space, change, events, processes,
physical objects, substances, mental objects,
beliefs
48A General Ontology Hierarchy