Knowledge Representation

Knowledge
Representation
Cause the world is more
complicated
than a 3x3 Array...
Weak Methods
General Purpose Methods
No Domain Knowledge
But can be added
Weak Methods
Search
Generate & Test (Random Search)
Hill Climbing (Local search)
Brute Force
Brute force algorithm:
Look through every possible solution,
in order.
Guaranteed to work... someday
Requires pre-knowledge of how to
enumerate
Generate &Test
Generate a random answer
Test it.
Cheaper than Brute Force but not
guaranteed
Hill Climbing
Simplest form of search
No Storage Costs for cycle checking
Here is the algorithm:
Look around and move in best direction
REPEAT (UNTIL SATISFIED OR FOREVER)
add random noise to current solution
If new solution is "better" then current
then choose it
else keep current
Hill Climbing
Has not been considered particularly
useful part of AI toolkit.
Yet, it recently has come back hidden
inside various Machine Learning
systems like:
Genetic Algorithms
Simulated Annealing
Neural Net learning
Strong = weak + knowledge
We add knowledge to weak methods
in various ways
heuristic value functions for games
estimated distance for search
Order of operations within programs
subconscious choices of arrangements
based on programming experience
etc.
How can we make knowledge
explicit
separate the knowledge from the
code so it can be
made visible
printed out
used to explain machine behavior
modified easily
validated for security
etc.
Need for Knowledge
Representation
Situations for AI which are more
complex than puzzles and games
States of Human Affairs
Representation of Complex Rules
Understanding of Language
Representing Mechanisms for Design
and Diagnosis
Bureacratic Rules
Knowledge Representation
For Real World Problems:
Lots of Knowledge
Complex Interactions
Partial State Information
Ambiguity
Un-knowable
Dynamically changing
Evaluating KR Schemes
how can we get that knowledge into
machines?
Is knowledge domain-specific or
general?
How can we get at it?
How flexible is it?
How can we change it?
Representational Adequacy
How can facts about the world be
represented in data-structures?
Is our representation adequate to the
domain?
Is First Order Predicate Calculus
(FOPC) adequate for all human
knowledge?
Representational Adequacy
Under the "law of representation" we know
that if you need to represent 2^k things,
you need k bits
How many "ideas" are there?
If representation is too weak, you cannot
get at necessary discriminations
Representing visitors to a website by the IP
address, misses different users in cybercafe or
berry patch
Representing tetraminos without parity
Representing air-flight without plane-type
means you can't do seat assignments
Knowledge Accessibility
How can the represented knowledge
be indexed and used?
How can it be manipulated and
processed?
How can it be incremented?
Inferential Ability
How can inference be accomplished?
Will it be efficient?
How will inference be controlled?
It is very easy to create infinite
variations of knowledge from a finite
set of statements
KR Methods
Procedural Representations
Computer Programs
Feature Systems
Database Systems
Example: Computer Programs
A Procedural Representation
Adequate?
Yes, Turing Universal
Accessible?
No, compiled and distributed
Translation?
yes, but need BS in CS
Inference?
Not usually, Needs Upgrade
Feature Systems
Each object is represented by a vector
Each position in the vector represents a
feature
Each number in a position represents the
objects value of that feature
Color
1=red
Size
0 small, 1 big
Shape
3 triangle, 4 squar
Weight
in oz.
Organizes data well, but allows no
compositionality or flexibility as the situation
changes.
Database Systems
flight
from
to
chicago
ny
4.45
231
ny
chicago
9:45
101
ny
tokyo
6550
time
12:00
Scalable
Transaction Based
Arbitrary complexity of
representation, but
some Tables get large
Change of
representation tables
can require "Database
Architect" and
downtime.
Basic Knowledge Representation
Techniques in AI
Semantic Networks/Frames
Logic
Semantic Networks
Invented by M. Ross Quillian,
1968
Used a labelled graph to represent
meanings of words in an electronic
dictionary
Technology was intensely developed
throughout the 1970's
Woods, Brachman, Shapiro, Fahlman
Elements of Semantic Networks
Nodes
Labeled circles
Represent Concepts
Types (classes)
Tokens (individuals)
Elements of Semantic Networks
Links
Labeled Arrows
Represent Relations Between
Concepts
Only a finite set of link types are
allowed!
Standard Links
IS-A
PART-OF
MODIFIES
Link types are set up for specific
domain knowledge
Example of Semantic Network
thing
ISA
anim
inanim
ISA
animal
body
human
PARTOF
ISA
mammals
fish
head
trunk
PARTOF
ISA
dogs
ISA
snoopy
HAS
eyes
ears
Analysis of Semantic Networks
For a particular Domain, you
make up a set of link-types
Create a set of nodes
connect them together
Ascribe Meaning
Write Programs to manipulate the
knowledge
Basic Lisp Implementation
Use native symbols
store links using the "property list"
This is BAD BAD BAD
Only one instance of a symbol exists.
Puts part of a program into permanent
memory structure of lisp
Doesn't allow "multiple views"
Uses Destructive operations
10.1. The Property List
Since its inception, Lisp has associated with each
symbol a kind of tabular data structure called a
property list (plist for short). A property list contains
zero or more entries; each entry associates with a
key (called the indicator), which is typically a symbol,
an arbitrary Lisp object (called the value or,
sometimes, the property). There are no duplications
among the indicators; a property list may only have
one property at a time with a given name. In this way,
given a symbol and an indicator (another symbol), an
associated value can be retrieved.
Alists?
A property list is very similar in purpose to an
association list. The difference is that a property list is
an object with a unique identity; the operations for
adding and removing property-list entries are
destructive operations that alter the property list
rather than making a new one. Association lists, on
the other hand, are normally augmented
non-destructively (without side effects) by adding
new entries to the front (see acons and pairlis).
Alist is a list of pairs which could also be a hashtable,
except they were invented first.
((name . jordan) (department . cs) (subfields AI Alife
EC NN))
CL Implementation
A property list is implemented as a memory cell containing a list
with an even number (possibly zero) of elements. (Usually this
memory cell is the property-list cell of a symbol, but any
memory cell acceptable to setf can be used if getf and remf are
used.) Each pair of elements in the list constitutes an entry; the
first item is the indicator, and the second is the value. Because
property-list functions are given the symbol and not the list
itself, modifications to the property list can be recorded by
storing back into the property-list cell of the symbol.
In other words (name jordan department cs subfields (ai alife ec
nn))
When a symbol is created, its property list is initially empty.
Properties are created by using get within a setf form.
Basic Semantic Network
;makes an atomic value
(defun attr (entity attribute value)
(setf (get entity attribute) value))
;makes a list value for multiple
inheritance
(defun isa (entity1 entity2)
(setf (get entity1 'isa)
(cons entity2 (get entity1 'isa))))
How are Inferences Organized?
Usually by external programs which
manipulate the network!
Semantic Networks effectively
provided a single type of inference
Property Inheritance (which became
the basis for OOP)
Property Inheritance
A form of Default Reasoning
BIRD
CAN
FLY
ISA
SPARROW
ISA
TWEETY
Therefore, Tweety can fly!!
What about Ostriches?
Need Non-Monotonic Blocking form
of multiple inheritance!
Setting up a hierarchy
(isa 'snoopy 'dog)
(isa 'dog 'mammal)
(isa 'human 'mammal)
(isa 'mammal 'animal)
(isa 'animal 'anim)
(isa 'anim 'thing)
(isa 'inanim 'thing)
(isa 'furniture 'inanim)
(isa 'desk 'furniture)
(isa 'bed 'furniture)
adding other stuff
(attr 'dog 'has-fur 'yes)
(attr 'human 'has-skin 'yes)
(attr 'mammal 'has-legs 'yes)
(attr 'furniture 'has-legs 'no)
(attr 'furniture 'has-fur 'no)
Get a local attribute
The native "get" from property lists works
ok
(get 'snoopy 'isa)
(DOG)
(get snoopy 'has-legs)
(nil)
We use an inference called inheritance
Simple inheritance
(defun get-attr (entity attribute)
(or (get entity attribute)
(loop for e in (get entity 'isa) thereis
(get-attr e attribute))))
Now, a feature attached higher in hierarchy
can be retrieved from any descendent in ISA
tree...
when inheritance fails
What about Ostriches not flying?
What about Snoopy Beds?
Both animate and inanimate?
Need Non-Monotonic Blocking form of
multiple inheritance!
Many Ph.D's theses were written about this.
"Elephants are grey",
"Clyde is an elephant"
"Clyde is pink".
What does IS-A mean, exactly?
Set inclusion?
Generalization?
f(x) -> f(y)
Concept Containment? any feature of x is a feature of y
a trunk is a cylinder
Description?
tweety is a bird
Instantiation?
Representational Adequacy?
As strong as Logic with procedures
attached as strong as a turing
machine!
Sometimes too good, and one cannot
make any sense out of the network!
prop
isa
quant
every
goo7
body
agent
man
loves
obj
woman
Knowledge Accessibility
Network Can be fully indexed,
where each link and each node are
kept in easily accessible tables
But as network grows, data
management needs increase, leading
to techniques, e.g. for neighborhoods
of related objects (Partitions)