110 likes | 261 Views
KM’s Inference Algorithm . Peter Clark Knowledge Systems Boeing Math & Computing Technology. The Top-Level KM Algorithm. An atomic value returns itself Otherwise, apply a set of rewrite rules to decompose the expression
E N D
KM’s Inference Algorithm Peter Clark Knowledge Systems Boeing Math & Computing Technology
The Top-Level KM Algorithm • An atomic value returns itself • Otherwise, apply a set of rewrite rules to decompose the expression • Decomposing a KM expression corresponds to breaking up its equivalent logical expression KM: (the age of (the spouse of Pete)) -> find x, (the spouse of Pete) -> find (the age of x) LOGIC: {y | spouse(Pete,x), age(x,y)} -> find x in spouse(Pete,x) -> find y in age(x,y) • Eventually, decomposed to KM’s basic operations • If an instance changes, re-check its classification
The Top-Level KM Algorithm PROCEDURE km(expr) -> values If expr is an atomic value, return expr Else: REWRITES: PATTERN: REWRITE AS: (the slotof expr) km(expr) -> f, km(the slot of f) (allof expr where test) km(expr) -> set, return i in set if km(test) (if test then expr) km(test) -> boolean, if boolean then km(expr) ... PRIMITIVES: (instance has slotsvals) : Assert in KB (every class has slotsvals) : Assert in KB (a class has slotsvals) : Generate Skolem, then assert in KB (the slot of frame) (frame1 & frame2) (set1 && set2) PROCEDURE classify(instance) Ifinstance’s properties change then check its classification
1. Computing the value of a slot • Corresponds to: • find all the x where slot(instance,x) is true • (or, can think of slot as a function on instance) • Algorithm: • Collect all the information about instance’s slot • local • inherited • Evaluate and combine that information
1. Computing the value of a slot Person age: (a Number) ;;; Working on an individual clause PROCEDURE: (the slot of frame) -> values 1. Find the set of "local" values on frame's slot [projection, subslots, global situation] 2. a. Find all the classes of frame b. For each class, find the set of values on the class's slot 3. Set-unify the sets together km(set1 && set2 && ..) [For single-valued slots, do km(set1 & set2 & set3 ...)] 4. a. Find the local and inherited constraints on the slot b. Check and enforce those constraints 5. Assert the resulting values on the frame's slot 6. Return the final set of values *Fred age: 32
2. Unification (asserting equality) • The syntactic process of merging two data structures corresponds to the semantic process of asserting equality • if x = y, then • all things true of x will be true of y, and vice versa • so the data structure denoting things true of x will also be part of the data structure denoting things true of y, and vice versa
2. Unification (asserting equality) PROCEDURE: (frame1 & frame2) -> frame12 1. Choose a name for the unified frame frame12 2. For the slots used in frame1 and frame2: a. Find the values vals1 of slot on frame1 b. Find the values vals2 of slot on frame2 c. Create a new structure (slot ((vals1 && vals2))) d. Find constraints on slot (in vals1,vals2, and inherited) Check that vals1, vals2, and (vals1 && vals2) don't violate constraints 3. Assemble these pieces together (frame12 has (slot1 ((vals1 && vals2))) (slot2 ((vals1 && vals2))) ...) 4. Assert it in the KB 5. "Bind" frame1 and frame2 to frame12 *Fred age: 32 owns: _Car1 & _Person2 owns: _Car2 *Fred age: 32 owns: ((_Car1) && (_Car2)) Binding List: _Person2 -> *Fred
3. Set Unification • Goal is to “sensibly” combine information from different frames together • Can think of this as: • non-deductive inference step • deductive based on an additional coreference algorithm
3. Set Unification PROCEDURE: (set1 && set2) -> set12 1. For each value v in set1 a. Find a value v' in set2 a. whose classes are equal/generalization/specialization of v's b. which can be consistently unified with v b. If there is a v' then add (v & v') to set12, and remove v' from set2 else add v to set12 2. Add remaining values in set2 to set12 3. Return set12 (_Cat1 _Dog1) && ((a Cat) (a Dog)) -> (_Cat1 _Dog1)
The next level of detail • Situations, projection • Caching • Explanation • Automatic classification • Text generation • Defaults • KB loading/saving/checking • Loop detection • Recursive calls • Prototypes
Further Reading • The KM Manuals • The KM Tutorial • powerpoint • “Building Knowledge Bases from Reusable Components” AAAI’97 • paper, describes an example of the interleaving of backward chaining (path following) and automatic classification • “Using Access Paths to Guide Inference with Conceptual Graphs”, ICCS’97 • paper and animated powerpoint. Describes KM’s top-level algorithm in detail, along with a worked example. • The powerpoint gives an animation of this inferencing in operation. • Short note on the implementation of situations • technical note All available at: http://www.cs.utexas.edu/users/mfkb/km.html