KNOWLEDGE REPRESENTATION Lecture 2 Knowledge Representation
Knowledge Representation: Principles and Techniques Lexical ambiguity of natural language “Visiting aunts can be a nuisance” Need for common sense knowledge “The hammer hit the vase and it broke” “The vase hit the wall and it broke” “the X hit the Y and it broke” In each of the above, what does ‘it’ refer to ? Lecture 2 Knowledge Representation
Predicate-argument Expression <sentence><predicate>(<argument>,…,<argument>) e.g. at(robot, roomA) Interpretation: Robot is located in Room A (and not Room A is located at the robot) Lecture 2 Knowledge Representation
Knowledge Representation STRIPS Planner push(X,Y,Z) Preconditions: at(robot,Y), at(X,Y) Delete list: at(robot,Y), at(X,Y) Add list: at(robot,Z), at(X,Z) move(X,Y) Preconditions: at(robot,X) Delete list: at(robot,X) Add list: at(robot,Y) Lecture 2 Knowledge Representation
STRIPS Planner in Action Start at(robot,roomA) at(box1,roomB) at(box2,roomC) move(roomA,roomB) X/roomA,Y/roomB P: at(robot,roomA) D: at(robot,roomA) A: at(robot,roomB) push(box1,roomB,roomA) X/box1,Y/roomB,Z/roomA P: at(robot,roomB) P: at(box1,roomB) D: at(robot,roomB) D: at(box1,roomB) A: at(robot,roomA) A: at(box1,roomA) move(roomA,roomC) X/roomA,Y/roomC A: at(robot,roomC) push(box2,roomC,roomA) X/box2,Y/roomC,Z/roomA P: at(robot,roomC) P: at(box2,roomC) D: at(robot,roomC) D: at(box2,roomC) A: at(box2,roomA) Goal at(box1,roomA) at(box2,roomA) Lecture 2 Knowledge Representation
Knowledge Representation MYCIN Domain: treatment of blood infection Decision process: Deciding if patient has significant infection Determining possible organisms involved Selecting a set of appropriate drugs Choosing most appropriate drug(s) Lecture 2 Knowledge Representation
Organization of MYCIN Consultation program Explanation program Knowledge acquisition program Static knowledge base Dynamic patient data Physician user Infectious disease expert Lecture 2 Knowledge Representation
MYCIN’s Control Structure IF 1) there is an organism which requires therapy, and 2) consideration has been given to any other organisms requiring therapy THEN compile a list of possible therapies, and determine the best one in this list. Lecture 2 Knowledge Representation
Knowledge Representation Consultation Session Create the patient context as the top node in the context tree; Attempt to apply the goal rule to this patient context. Consultation is essentially a search through a tree of goals. The leaves of the tree as fact goals, such as laboratory data. Lecture 2 Knowledge Representation
An example of MYCIN’s rules IF 1) The stain of the organism is gramneg, and 2) The morphology of the organism is rod, and 3) The aerobicity of the organism is aerobic THEN There is strongly suggestive evidence (.8) that the class of the organism is enterobacteriaceae Lecture 2 Knowledge Representation
Knowledge Representation MYCIN Context Tree Patient-1 Culture-1 Culture-2 Culture-3 Operation-1 Organism-1 Organism-2 Organism-3 Drug-1 Drug-2 Lecture 2 Knowledge Representation
Example data for organism-1 GRAM = (GRAMNEG 1.0) MORPH = (ROD 0.8) (COCCUS 0.2) AIR = (AEROBIC 0.6) Considering the preceding rule, CF(premise) = min(1.0 , 0.8 , 0.6) = 0.6 CF(action) = CF(premise) × CF(rule) = 0.6 × 0.8 = 0.48 Lecture 2 Knowledge Representation
Knowledge Representation AND/OR Tree BADGE SHIELD GUN POLICE REVOLVER PISTOL RIFLE Lecture 2 Knowledge Representation
Knowledge Representation Evidence Combination Let X and Y be weights derived from the application of two different rules. Combined certainty of both rules: Lecture 2 Knowledge Representation
Knowledge Representation Evaluation of MYCIN Ratings by 8 experts on 10 cases Perfect score = 80 MYCIN 52 Actual Therapy 46 Faculty-1 50 Faculty-4 44 Faculty-2 48 Resident 36 Inf dis fellow Faculty-5 34 Faculty-3 Student 24 Lecture 2 Knowledge Representation
Comparing MYCIN and STRIPS Both have goal-driven control structure STRIPS is knowledge-poor (weak method) MYCIN is domain specific (strong method) Lecture 2 Knowledge Representation
Symbolic Representation Syntactic rules to form symbol structures out of symbols Transformation rules to turn symbol structures into other symbol structures Programs in such languages are themselves symbol structures Lecture 2 Knowledge Representation
Physical Symbol System Hypothesis “A physical symbol system has the necessary and sufficient means for general intelligent action” − Newell & Simon (1976) Lecture 2 Knowledge Representation
Symbol Structures in LISP LISP: LISt Processing LISP differs from most programming languages in three important respects: Its main data structure is the list; Its programs are also represented by list structures; and Its primitive operations are operations on lists. Lecture 2 Knowledge Representation
Knowledge Representation Lists and Dotted Pairs Any atom is an S-expression If A1 and A2 are S-expression, then (A1 . A2) is an S-expression If S = (A1 . (A2 . (… . (An-1 . An)…) is an S-expression for n>0, then S is a list if and only if An = NIL (S1 . (S2 . (S3 . NIL))) is simply (S1 S2 S3) (A . B) is not a list. It is a dotted pair. Lecture 2 Knowledge Representation
Knowledge Representation LISP Programs (<function> <1st argument> <2nd argument>) e.g. (+ X Y) To treat a list as merely a data structure rather than a program, use “quote” (quote X) or ’X ’( (1 2 3) (4 5 6) (7 8 9) ) Lecture 2 Knowledge Representation
Function Definition in LISP (defun <function name> (<formal parameters>) <function body> ) e.g. (defun SQUARE (X) (* X X ) ) Lecture 2 Knowledge Representation
Processing Association Lists (defun assoc (key alist) (cond ((null alist) NIL) ((eq (first (first alist)) key) (first alist)) (t (assoc key (rest alist)))) (assoc ’alaska ’( (alabama montgomey) (alaska juneau) …) ) Lecture 2 Knowledge Representation
Knowledge Representation Pattern Matching (defun match (sample pattern) (cond ((and (null sample) (null pattern)) T) ((or (null sample) (null pattern)) NIL) ((eq (first pattern) ’?) (match (rest sample) (rest pattern) ) ) ((eq (first sample) (first pattern) ) (T NIL) ) Lecture 2 Knowledge Representation
Pattern Matching (contd.) (match ’(at robot room) ’(at robot ?) ) T (match ’(at box room) ’(at robot ?) ) NIL (match ’(at robot room) ’(at ? ?) ) Lecture 2 Knowledge Representation
Function Definition in CLIPS (deffunction hypotenuse (?a ?b) (sqrt (+ (* ?a ?a) (* ?b ?b) ) ) ) (hypotenuse 3 4) 5.0 Lecture 2 Knowledge Representation
CLIPS for Rule-based Systems Freeware, available at: http://www.ghg.net/clips/CLIPS.html Borrows features from other tools Fairly standard LISP-like syntax Reasonably efficient Reasonably flexible Facilities for combining rules with objects Lecture 2 Knowledge Representation