Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Chapter 9 Rules and Expert Systems Expert System (Rule Based Inference) Bayesian Network Fuzzy Theorem Probability (statistics) Uncertainty (cybernetics)

Similar presentations


Presentation on theme: "1 Chapter 9 Rules and Expert Systems Expert System (Rule Based Inference) Bayesian Network Fuzzy Theorem Probability (statistics) Uncertainty (cybernetics)"— Presentation transcript:

1 1 Chapter 9 Rules and Expert Systems Expert System (Rule Based Inference) Bayesian Network Fuzzy Theorem Probability (statistics) Uncertainty (cybernetics) Machine Learning Fuzzy, NN, GA, etc. Diagnosis (Decision Making) Advice (Recommendations) Automatic Control Pattern Recognition Data Mining, etc. Problem SolvingPredicate Logic Reasoning/ ProofSearch Methods

2 2 Deduction over FOPC --- Resolution Barks_at(Snoopy,John)  FalseDog(X) ^ Meets(X,Y)^Dislikes(X,Y)  Barks_at(X,Y) Dog(Snoopy) ^ Meets(Snoopy,John)^Dislikes(Snoopy,John)  F {X/Snoopy, Y/John} T  Dog(Snoopy) Meets(Snoopy,John)^Dislikes(Snoopy,John)  False Close_to(Z,DormG)  Meets(Snoopy, Z) Close_to(John,DormG)^Dislikes(Snoopy,John)  False {Z/John} True  Close_to(John, DormG) Dislikes(Snoopy,John)  False Man(John)  False {W/John} True  Man(John) True  False Man(W)  Dislikes(Snoopy,W) 此為 “Implies” Normal Form 了解此法可以銜接 “Expert System” Recall:

3 3 Refutation Proofs in Tree Form PQPQ  True  PQ  False True  Q True  False P, P  Q Should Q be true? ¬ P VQ P ¬Q¬Q Q  這兩種形式  皆有相關研究採用 Forward Chaining + Refutation Recall:  P  False True  False ¬P¬P Backward Chaining (Resolution) Q  FalsePQPQTrue  P ¬ P VQ P ¬Q¬Q

4 4 Chapter 9 Contents l Rules for Knowledge Representation l Rule Based Production Systems l Forward Chaining l Conflict Resolution l Meta Rules l Backward Chaining l The Architecture of Expert Systems l Expert System Shells l The Rete Algorithm l Knowledge Engineering l CLIPS: C Language Integrated Production System l Backward Chaining in Expert Systems l CYC System

5 5 Rules for Knowledge Representation l IF… THEN Rules can be used to represent knowledge: nIF it rains, then you will get wet l Rules can also be recommendations: nIF it rains, then you should wear a coat

6 6 Example (Rule Based Inference) rains_on(x)  wet(x) rains_on(x) ^ ¬coat(x)  wet(x) True  rains_on(John) True  wet(John)wet(John)  False {x/John} True  rains_on(John) ¬coat(John)  wet(John) {x/John} ¬ wet(John)  False …wet(John) 是否成立 ? … ¬ wet(John) 如何能成立 ? p.s. 不穿雨衣一定溼,但穿雨衣不保證不溼 如果 ¬coat(John) 會導致 wet(John) 成立 Trure  ¬coat(John) True  wet(John)

7 7 Rule Based Production Systems l A production system is a system that uses knowledge in the form of rules to provide diagnoses or advice on the basis of input data. l The system consists of a database of rules (knowledge base), a database of facts, and an inference engine which reasons about the facts using the rules.

8 8 Forward Chaining l Forward chaining is a reasoning model that works from a set of facts and rules towards a set of conclusions, diagnoses or recommendations. l When a fact matches the antecedent of a rule, the rule fires, and the conclusion of the rule is added to the database of facts.

9 9 Example (Forward Chaining) Man(W)  Dislikes(Snoopy, W) {W/John} T  Man(John) T  Dislikes(Snoopy, John) Close_to(Z,DormG)  Meets(Snoopy, Z) {Z/John} T  Close_to(John, DormG) T  Meets(Snoopy, John) Dog(X) ^ Meets(X,Y)^Dislikes(X,Y)  Barks_at(X,Y)T  Dog(Snoopy) Meets(Snoopy,Y)^Dislikes(Snoopy,Y)  Barks_at(Snoopy,Y) {Y/John} Meets(Snoopy,John)  Barks_at(Snoopy,John) T  Barks_at(Snoopy,John) (1)(2) (3) (4) (5) Barks_at(Snoopy,John)  False ?

10 10 Conflict Resolution 牴觸的規則 l Sometimes more than one rule will fire at once, and a conflict resolution strategy must be used to decide which conclusions to use. l One strategy is to give rules priorities and to use the conclusion that has the highest priority. l Other strategies include applying the rule with the longest antecedent, or applying the rule that was most recently added to the database. (1) 天氣好, 睡得好, 工作不忙  去打球; vs.“ 吃飽飯  不打球 ” (2) 男生, 穿拖鞋, 靠近女生宿舍  小花吠 ; vs.“ 吃飯中  不吠人 ” Priority?

11 11 Meta Rules l The rules that determine the conflict resolution strategy are called meta rules. l Meta rules define knowledge about how the system will work. l For example, meta rules might define that knowledge from Expert A is to be trusted more than knowledge from Expert B. l Meta rules are treated by the system like normal rules, but are given higher priority.

12 12 Backward Chaining l In cases where a particular conclusion is to be proved, backward chaining can be more appropriate. l Works back from a conclusion towards the original facts. l When a conclusion matches the conclusion of a rule in the database, the antecedents of the rule are compared with facts in the database.

13 13 Example (Backward Chaining) Barks_at(Snoopy,John)  FalseDog(X) ^ Meets(X,Y)^Dislikes(X,Y)  Barks_at(X,Y) Dog(Snoopy) ^ Meets(Snoopy,John)^Dislikes(Snoopy,John)  F {X/Snoopy, Y/John} T  Dog(Snoopy) Meets(Snoopy,John)^Dislikes(Snoopy,John)  False Close_to(Z,DormG)  Meets(Snoopy, Z) Close_to(John,DormG)^Dislikes(Snoopy,John)  False {Z/John} True  Close_to(John, DormG) Dislikes(Snoopy,John)  False Man(W)  Dislikes(Snoopy, W) Man(John)  False {W/John} True  Man(John) True  False

14 14 Example (Forward Chaining) Man(W)  Dislikes(Snoopy, W) {W/John} T  Man(John) T  Dislikes(Snoopy, John) Close_to(Z,DormG)  Meets(Snoopy, Z) {Z/John} T  Close_to(John, DormG) T  Meets(Snoopy, John) Dog(X) ^ Meets(X,Y)^Dislikes(X,Y)  Barks_at(X,Y)T  Dog(Snoopy) Meets(Snoopy,Y)^Dislikes(Snoopy,Y)  Barks_at(Snoopy,Y) {Y/John} Meets(Snoopy,John)  Barks_at(Snoopy,John) T  Barks_at(Snoopy,John) Recall:

15 15 Chapter 9 Contents l Rules for Knowledge Representation l Rule Based Production Systems l Forward Chaining l Conflict Resolution l Meta Rules l Backward Chaining l The Architecture of Expert Systems l Expert System Shells l The Rete Algorithm l Knowledge Engineering l CLIPS: C Language Integrated Production System l Backward Chaining in Expert Systems l CYC System

16 16 The Architecture of Expert Systems (1) l An expert system uses expert knowledge derived from human experts to diagnose illnesses, provide recommendations and solve other problems.

17 17 The Architecture of Expert Systems (2) l Knowledge base: ndatabase of rules (domain knowledge). l Explanation system: nexplains the decisions the system makes. l Knowledge base editor: nallows the user to edit the information in the knowledge base. l User Interface: nthe means by which the user interacts with the expert system.

18 18 Expert System Shells l The part of an expert system ( 內容不算 ) nNeither domain specific nor case specific knowledge is contained in the expert system shell. l A single expert system shell can be used nto build a number of different expert systems. l An example of an expert system shell is nCLIPS.

19 19 The Rete Algorithm l A rete is a directed, acyclic, rooted graph (i.e. a “Search Tree”). l A path from the root node to a leaf represents the left hand side of a rule. l Each node stores details of which facts have been matched so far. l As facts are changed, the changes are propagated through the tree from the root to the leaves. l This makes an efficient way for expert systems to deal with environments which change often. root recommendations dog(S) man(J) ¬ dog(S) ¬man(J)

20 20 Knowledge Engineering l A knowledge engineer takes knowledge from experts and inputs it into the expert system. ( 擷取 ) l A knowledge engineer will usually choose which expert system shell to use. ( 實現 ) l The knowledge engineer is also responsible for entering meta-rules. ( 整合 ) Expert System (Rule Based Production System) 只是後來所謂「知識工程」的一個小部份

21 21 CLIPS l CLIPS is C Language Integrated Production System – an expert system shell. l CLIPS uses a LISP-like notation to enter rules.

22 22 Backward Chaining in Expert Systems l Backward chaining is often used in expert systems that are designed for medical diagnosis: n For each hypothesis, H:  If H is in the facts database, it is proved.  Otherwise, if H can be determined by asking a question, then enter the user’s answer in the facts database. Hence, it can be determined whether H is true or false, according to the user’s answer.  Otherwise, find a rule whose conclusion is H. Now apply this algorithm to try to prove this rule’s antecedents.  If none of the above applies, we have failed to prove H. l Usually backward chaining is used in conjunction with forward chaining. 相輔相成

23 23 CYC l A frame based production system. l Uses a database of over 1,000,000 facts and rules, encompassing all fields of human knowledge. l CYC can answer questions about all kinds of knowledge in its database, and can even understand analogies, and other complex relations.

24 24 Relevant Research Expert System (Rule Based Inference) Bayesian Network Fuzzy Theorem Probability (statistics) Uncertainty (cybernetics) Machine Learning Fuzzy, NN, GA, etc. Diagnosis (Decision Making) Advice (Recommendations) Automatic Control Pattern Recognition Data Mining, etc. Problem SolvingPredicate Logic Reasoning/ ProofSearch Methods 評判搜尋解答邏輯推理記憶控制學習創作 weaksub?strong Fuzzy,NN,GA In my opinion:


Download ppt "1 Chapter 9 Rules and Expert Systems Expert System (Rule Based Inference) Bayesian Network Fuzzy Theorem Probability (statistics) Uncertainty (cybernetics)"

Similar presentations


Ads by Google