Ethical and Legal issues

Download Report

Transcript Ethical and Legal issues

Frames
• Knowledge bases can be enhanced by using principles from
frame knowledge representation (similar to object orientation)
• This is advantageous, as it permits large and complex knowledge bases
to be "smarter" -- essentially by implementing them as object-oriented
databases.
Object: formal structure which has variables which denotes its state and
procedures which denote its behaviors
Object-oriented programming: a style of programming where data and procedures
are encapsulated into objects. They communicate by passing messages
which invoke the encapsulating procedures.
Slot: an attribute or property
Facet: usually a value, but can be a default, constraint, description, or demon
Demon: Rules or procedures activated under certain conditions, eg. when a
slot value is being modified
Frames: formal structure that contains an object's slots and facets
B. Ross Cosc 4f79
1
Frames
Definitions (cont)
• Inheritance : Frames or objects can be organized into hierarchies such that
members of classes can derive (inherit) slots and values from classes
above them
• I will first show some code which implements three basic frame utilities:
get_frame: retrieves attrobute values for a frame
add_frame : adds or updates attribute values for a frame
del_frame:
deletes attribute values for a frame
Then this frame framework will be incorporated into the Oops forward
chaining system.
B. Ross Cosc 4f79
2
Frames
(6.1)
B. Ross Cosc 4f79
3
Frames
Data Structure
p.101, 100
B. Ross Cosc 4f79
4
Frames
1. get_frame
6.2
B. Ross Cosc 4f79
5
Frames
102,103,104,105
B. Ross Cosc 4f79
6
Frames
106
B. Ross Cosc 4f79
7
Frames
2. add_frame
107,108
B. Ross Cosc 4f79
8
Frames
3. del_frame
109,110
B. Ross Cosc 4f79
9
Frames
Example usage:
111,112
B. Ross Cosc 4f79
10
Comments
• Having a frame-based knowledge base means that it can be modified
very easily. Frames forces a structure to the KB.
• Contrast this with the static KB's, for example, the first bird KB.
Here, all the rules are "flat", and you can change any rule you like, which
can have dire effects on the soundness of the whole KB.
• A frame KB, however, is arguably less "declarative", since frame directives
introduce more implmentation-specific syntax and peculiarities.
B. Ross Cosc 4f79
11
Frame integration
• Oops: forward chaining expert system for furniture placement
• whole system implemented with productions
- some rules did system-specific operations, such as input and output
- these rules were messy
- the rules in general were large and complicated, since they dealt with
lots of descriptive facts about furniture which weren't directly related to
rules about how to place furniture
• We can make this application much cleaner by:
1. Adding frames to represent items of furniture, walls, etc
- these frames will contain descriptive facts
2. Adding hooks to Prolog routines to do I / O, rather than in productions
3. Use production rules exclusively for placing furniture in room.
B. Ross Cosc 4f79
12
Frame integration
p. 133
B. Ross Cosc 4f79
13
Frame integration
p.120
B. Ross Cosc 4f79
14
Frame integration
1. Integrating frames
• incorporate frame classes (like before) and frame instances, which are
previous frames, but with
- class name
- instance (object) name
- slot-attribute value pair list
- time stamp (used for enhanced forward-chaining strategies)
• fancier frame format:
Class - Name with [Attr-Val, Attr-Val, ... ]
• typical rule:
rule f11:
[ table_lamp - TL with [ position-none ],
end_table - ET with [ position-wall/W]]
==>
[ update(table_lamp-TL with [ position-end_table/ET] )].
B. Ross Cosc 4f79
15
Frame integration
2. Prolog hooks
• add production actions test { LHS } and take { RHS } which refer to Prolog
routines
• inference engine will call these Prolog utilities directly
p.125-6
B. Ross Cosc 4f79
16
Frame integration
3. Productions
• We will describe furniture items and walls with frame instances.
• This permits the knowledge base to deal exclusively with rules for
placing furniture in a room
• furniture frames:
p.121-123
B. Ross Cosc 4f79
17
Frame integration
• furniture frames
B. Ross Cosc 4f79
18
Frame integration
• frame demons: called by frames to do specific actions
• initial data
p.125
B. Ross Cosc 4f79
19
Frame integration
• frame rules
p. 129
B. Ross Cosc 4f79
20
Frame integration
Conclusion:
• As with most non-trivial software systems, a mixture of techniques
can provide the clearest solution.
• This Foops system is a sophisticated shell
- inference uses efficiency techniques such as specificity, time stamps, ...
- the frame component can be used for programming applications
- hooks to general Prolog means that rules and frames are not burdened
with system code
- Prolog's adaptive syntax means that prettier rule formats are trivial to
derive (Try doing that in any other language!)
B. Ross Cosc 4f79
21