3.2 Rule Sets / Production Systems � 3.2.1 PROLOG � n Focus on operational knowledge: � General idea: � � if condition then action � n program descriptively by just stating axioms in a n Uses a logic: � logic and asking queries � usually propositional or multi-valued ( F probabilistic n guide interpreter by clear evaluation control scheme � rules) � n whole concept is based on SLD-resolution � n Actions include input-requests, output, changes of knowledge-base � n If several rules can be applied, a conflict manager decides what to do � F defines the operational semantics of the system � F must be well understood by knowledge engineer � CPSC 433 - Artificial Intelligence Jörg Denzinger CPSC 433 - Artificial Intelligence Jörg Denzinger Basic data structures � Semantics (I) � n Horn clauses in first-order logic, � n Operational semantic using a goal stack and the list i.e. clauses of form ¬A 1 ∨ ... ∨ ¬A n ∨ B � of clauses (data base/knowledge base): � written: B:- A 1 ,…,A n � Data base: � ?- G 1 ,G 2 ,…,G m � read: if A 1 and … and A n then B � ... � σ 1 (G 1 ) = σ 1 (A 1 ) � n Some higher-order predicates to manipulate the set A 1 :-B 11 ,…,B 1n1 . � ... � (list) of clauses in the knowledge base, influence the ?- σ 1 (B 11 ),…, σ 1 (B 1n1 ), σ 1 (G 2 ),…, σ 1 (G m ) � A k :-B k1 ,…,B knk . � . σ 1 (B ij )not solvable � interpreter, or provide in- and output. � . ... � . F backtrack � ?- G 1 ,G 2 ,…,G m � σ 2 (G 1 ) = σ 2 (A 2 ) � σ I mgus � ?- σ 2 (B 21 ),…, σ 2 (B 2n2 ), σ 2 (G 2 ),…, σ 2 (G m ) � CPSC 433 - Artificial Intelligence Jörg Denzinger CPSC 433 - Artificial Intelligence Jörg Denzinger How to get knowledge into the Semantics (II) � representation structure � n Solution: if goal stacks get empty � n By writing a declarative problem description � � � ð � collect substitutions that fulfilled � n Caution: take into account the semantics! � � � � original goals � Especially that we have an and-or-tree-based search � � ð � use as answer � with a special depth-first control (that in fact boils n Next solution: initiate backtrack � down to and-tree-based search with backtracking) � F ordering of clauses in data base very important: � n No solution: � � from very specialized to very general � if no clause in data base solves a particular subgoal G i for all solutions to G 1 ,…,G i-1 � CPSC 433 - Artificial Intelligence Jörg Denzinger CPSC 433 - Artificial Intelligence Jörg Denzinger 1
Discussion � And what about processing data? � ✚ In theory: describing knowledge by logic rules n Follow operational semantics � F not really search � enough; no control necessary � n Rely on user/programmer knowing what he/she is ✚ Fast prototyping very easy! � doing � - Not really much left from logic � - Exact understanding of operational semantic necessary to use � F Just another (not very efficient) programming language � CPSC 433 - Artificial Intelligence Jörg Denzinger CPSC 433 - Artificial Intelligence Jörg Denzinger Examples � 3.2.2 MYCIN / EMYCIN � n Write a PROLOG program that given facts of the form � General ideas: � � � mother(a,b). � � father(a,b). � n Deal with unsure/uncertain knowledge � meaning a is mother, resp. father of b, answers questions like � n Use in expert system � � ?- grandmother(agnes,X). � F dialog with user � � ?- grandfather(Y,clara). � n MYCIN: medical expert system � n Given the facts: � n EMYCIN: expert system shell employing logic, mother(anna,peter). mother(anna,clara). semantics, calculus and control of MYCIN, not the father(joe,peter). father(jim,clara). particular knowledge � mother(mary,anna). father(tom,joe). � Answer: � ?- grandfather(tom,X). � � � ?- grandmother(X,peter). � CPSC 433 - Artificial Intelligence Jörg Denzinger CPSC 433 - Artificial Intelligence Jörg Denzinger Basic data structures � Semantics � n Object-attribute-value triples as base logic: � for all a ∈ F: τ (a) = 0 � (objects and values) � for all x ∈ V: τ (x) = 0 � (object and value variables) � n Interpret all symbols for a fixed domain D � for all A ∈ PI: τ (A) = 2 � (attributes) � n Start with given interpretation for selected object- P = PV = {} � attribute-value-triples (input-data) and given truth triple realized as A(e,v): � values for all production rules � attribute A of object e has value v � n Use operational semantics based on computing � n Production rules form the formulas: � ● Measure of belief (MB) � J = { ¬ , ∧ } ∪ { → i |i = 1,…,n, if there are n production � ● Measure of disbelief (MD) � � � � rules} � Q = {} � n Deal with uncertain knowledge by using W=[-1,1], resp. discrete representation {-1,-0.9,…,0.9,1} � CPSC 433 - Artificial Intelligence Jörg Denzinger CPSC 433 - Artificial Intelligence Jörg Denzinger 2
How to get knowledge into the Measures of belief/disbelief � representation structure � Let h be an object-attribute-value triple and e a set of production rules. If P 1 ∧ … ∧ P n → i h is the only rule in n The rules are defined by an expert, who also defines e, then we get � what objects and attributes are of interest and what � MB(h,e) = I(P 1 ∧ … ∧ P n → i h)*max(0,min(I(P 1 ),…,I(P n )) � values they can have. � If e = {e 1 ,e 2 }, then we get � n The expert also has to provide the interpretation for MB(h,{e 1 ,e 2 }) = 0, if MD(h,{e 1 ,e 2 }) = 1 � the rules, by expressing how confident he/she is in MB(h,{e 1 ,e 2 }) = MB(h,{e 1 }) + MB(h,{e 2 })*(1-MB(h,{e 1 })) � this rule � For more elements just iterate this. � n The interpretation for the input data is provided by MD is computed similarily, except that e contains all observation/measuring of the world (in MYCIN, by a production rules of the form P 1 ∧ … ∧ P n → i ¬ h � doctor interpreting the examinations of the patient). � F application of Bayes formula for conditional probabilities � CPSC 433 - Artificial Intelligence Jörg Denzinger CPSC 433 - Artificial Intelligence Jörg Denzinger Discussion � And what about processing data? � ✚ Allows to deal with uncertainty � n Very similar to PROLOG � ✚ Successful in several applications � n Rules are applied backwards: � - Application domain has to be small � ● Select an object-attribute-value-triple for which an interpretation is sought and add it to the goal list: � - Hands-on approach to probability theory � ● Repeat: � - Hides the need for TMS � n Select h from goal list � - Gets very complicated for large rule sets with the same conclusion � n Find a rule e with h or ¬ h as consequence � n Add premisses to goal list and update interpretation of h by MB(h,e) - MD(h,e), resp. combine values for h from other rules � CPSC 433 - Artificial Intelligence Jörg Denzinger CPSC 433 - Artificial Intelligence Jörg Denzinger Examples (I) � Examples (II) � n Construct MYCIN rules for the following knowledge: � ● If the preparation for the exam is good and the n Interpret the statement � student slept well, then there is a good chance � Joe passes the exam � (0.7) that the student will pass the exam. � if you know that � ● If the student ’ s contribution to the team effort is ● I(Preparation(Joe,good)) = 0.7 � high and the workload of the student is low, then ● I(Sleep(Joe, well)) = 0.6 � there is a good chance (0.8) that the student will ● I(TeamContrib(Joe,high)) = 0.9 � pass the exam. � ● I(Workload(Joe,low)) = 0.6 � ● If the workload of the student is high and the ● I(ExtraAct(Joe,high)) = 0.3 � extra-curricular activities are high, then there is a good chance (0.6) that the student will fail the exam. � CPSC 433 - Artificial Intelligence Jörg Denzinger CPSC 433 - Artificial Intelligence Jörg Denzinger 3
3.2.3 General Discussion � n Production rule systems can be seen as special logics based on operational semantics that take away the search aspect of the logics in 3.1. � n When using production systems, dealing with the control therefore requires more than just application knowledge and makes defining the knowledge base difficult. � n New development: learning of rules by providing input-output pairs for the intended behavior � CPSC 433 - Artificial Intelligence Jörg Denzinger 4
Recommend
More recommend