Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 ISAT 252: Analytical Methods IV Knowledge-Based Systems (KBS) and Declarative Programming KBS development and KBSDT Details Reading Assignment: Corvid.

Similar presentations


Presentation on theme: "1 ISAT 252: Analytical Methods IV Knowledge-Based Systems (KBS) and Declarative Programming KBS development and KBSDT Details Reading Assignment: Corvid."— Presentation transcript:

1 1 ISAT 252: Analytical Methods IV Knowledge-Based Systems (KBS) and Declarative Programming KBS development and KBSDT Details Reading Assignment: Corvid Quick Start Manual

2 2 Outline 1.Lecture 1:Introduction to KBS and declarative programming 2.Lecture 2: Knowledge-based systems (KBS): definition and requirements overview 3.Lecture 3: KBS development and programming details Examples 1.Snow board packageSnow board package 2.Guitar selectionGuitar selection 3.Auto audio systemAuto audio system

3 3 Objectives Students should be able to: Explain the steps involved in the EKBS development methodology State and explain how to determine whether a problem is a good candidate for an EKBS solution Represent declarative knowledge as a decision tree(s) Generate a rule base from decision trees Generate a forest of decision trees from a rule base

4 4 KBS Development Methodology Cycle ready for final evaluation? design assumption correct? final evaluation define problem & goals design & construct prototype analyze & correct test/use system failed passed noyes no yes Prototype evolution: define the problem design & construct a prototype test/use the system analyze & correct if design assumptions are no longer correct. go to step 2; otherwise, if the system in not ready for final testing, go to step 3; otherwise, final test: if the system fails the final test, go to step 4; otherwise; implement the system.

5 5 Knowledge-based systems development ready for final evaluation? design assumption correct? final evaluation define problem & goals design & construct prototype analyze & correct test/use system failed passed noyes no yes Selecting an appropriate problem requires a clear description of the problem and an assessment as to the FEASIBILITY of a KBS solution. Step 1: problem definition

6 6 Feasibility Guidelines Include: 1. The need must justify the cost and effort 2. The knowledge in not available in all situations where it is needed 3. The problem may be solved using reasoning 4. The domain is well structured and does not require common sense 5. The problem may not be better solved using other computing methods 6. Domain expertise exists, for example, a cooperative & articulate domain expert is available 7. The problem is of proper size and scope

7 7 What makes for a good domain? ALL MUST BE TRUE! Genuine experts exist Experts must generally agree about goals/choices Experts must be able to articulate and explain their method Problem must require cognitive not physical skills Task cannot be too difficult Problems should not require common sense

8 8 Knowledge-based systems development ready for final evaluation? design assumption correct? final evaluation define problem & goals design & construct prototype analyze & correct test/use system failed passed noyes no yes Design and prototype construction includes the following knowledge engineering tasks: 2.1 acquiring the domain knowledge 2.2 representing the domain knowledge 2.3 designing the prototype 2.4 coding the prototype These knowledge engineering tasks are interrelated and may require several iterations to set up step 3: test/use. Step 2: design & prototype construction

9 9 Knowledge-based systems development ready for final evaluation? design assumption correct? final evaluation define problem & goals design & construct prototype analyze & correct test/use system failed passed noyes no yes Step 3: test/use the system Step 4: analyze and correct problems found in Step 3 Step 5: check the corrections against the design assumption and iterate through Steps 2 - 5 until there is nothing to correct. Step 6: decide if the system is ready for the final evaluation: if not, return to Step 3; otherwise, Step 7: perform final evaluation: if it fails, return to Step4; otherwise, Quit Steps 3 - 7:

10 10 Step 2 and Declarative Programming A declarative program provides the computer with a set of declarative statements (facts, relationships) about a domain and the system infers conclusions that logically follow. To accomplish this involves the interrelated tasks mentioned in Step 2 above: 1.knowledge acquisition - acquiring the knowledge about the subject matter domain; 2.knowledge representation - representing the knowledge such that it can be used by the humans involved and the computer system; 3.prototype design - that is, designing a solution that the client is OK with – show the client; 4.programming - that is, entering the knowledge-base into the system (coding the prototype) – show the client.

11 11 Knowledge Representation There are several formalisms to represent declarative knowledge Each formalism has representational advantages over the others IF-THEN Rules Many people express their knowledge in this way Easy to implement It may be hard to verify Decision Trees A graphical way to represent knowledge for reviewing with the expert from who it was obtained A decision tree represents a collection of decisions made by the expert in a certain order Easy to verify

12 12 1. IF The customer's income is less than 25,000. THEN The customer's line of credit is denied. 2. IFThe customer's income is at least 25,000. ANDThe customer's credit rating is excellent. THEN The customer's line of credit is approved. 3. IF The customer's income is at least 25,000. ANDThe customer's credit rating is good. ANDThe customer has been in their present job less than 2.5 years. THEN The customer's line of credit is denied. 4. IF The customer's income is at least 25,000. ANDThe customer's credit rating is good. AND The customer has been in their present job at least 2.5 years. THEN The customer's line of credit is approved. 5. IF The customer's income is at least 25,000. AND The customer's credit rating is poor. THEN The customer's line of credit is denied. EXSYS Corvid variables values goal-variables PSEUDO CODE RULES PCR the language in the GLS!

13 13 CORVID Goals: gV1: The customer's line of credit is 1.approved. 2.denied. CORVID Variables and VALUES: 1.V2: The customer's credit rating is 1.excellent. 2.good. 3.poor. 2.V3: The customer has been in their present job 1.less than 2.5 years. 2.at least 2.5 years. 3.V4: The customer's income is 1.less than 25,000. 2.at least 25,000. 1. IF The customer's income is less than 25,000. THEN The customer's line of credit is denied. 2. IFThe customer's income is at least 25,000. and The customer's credit rating is excellent. THEN The customer's line of credit is approved. 3. IF The customer's income is at least 25,000. and The customer's credit rating is good. and The customer has been in their present job less than 2.5 years. THEN The customer's line of credit is denied. 4. IF The customer's income is at least 25,000. and The customer's credit rating is good. and The customer has been in their present job at least 2.5 years. THEN The customer's line of credit is approved. 5. IF The customer's income is at least 25,000. and The customer's credit rating is poor. THEN The customer's line of credit is denied. KBS Assistant: DICTIONARY/GLOSSARY!

14 14 Assign Reading: Corvid Quick Start Manual Class Activity: Illustrate Corvid Using the Credit Example?

15 15 CORVID Goals: gV1: The customer's line of credit is 1.approved. 2.denied. CORVID Variables and VALUES: 1.V2: The customer's credit rating is 1.excellent. 2.good. 3.poor. 2.V3: The customer has been in their present job 1.less than 2.5 years. 2.at least 2.5 years. 3.V4: The customer's income is 1.less than 25,000. 2.at least 25,000. 1. IF The customer's income is less than 25,000. THEN The customer's line of credit is denied. 2. IFThe customer's income is at least 25,000. and The customer's credit rating is excellent. THEN The customer's line of credit is approved. 3. IF The customer's income is at least 25,000. and The customer's credit rating is good. and The customer has been in their present job less than 2.5 years. THEN The customer's line of credit is denied. 4. IF The customer's income is at least 25,000. and The customer's credit rating is good. and The customer has been in their present job at least 2.5 years. THEN The customer's line of credit is approved. 5. IF The customer's income is at least 25,000. and The customer's credit rating is poor. THEN The customer's line of credit is denied. KBS Assistant: DICTIONARY/GLOSSARY!

16 16 Conventions for Constructing a KBS Decision Tree 1.Trees are constructed to read from top to bottom (or left to right) 2. Nodes are labeled with variables 3. Edges are labeled with variables-values. 4.Terminal nodes (leafs) are labeled with variable-value pairs which represent either goals or sub-goals 5.Each complete path from the root to a terminal node (leaf) comprises a rule. 1.The terminal node is the Then-Part of a rule 2.The path up to the terminal node is the If-Part of a rule 6.Rules in a tree will be numbered left to right, rule 1 - rule n. (or top to bottom) Var 1 Var 2 Var 3 val 1 val 2 gV4-val 1 gV4-val-2 V5-val 1 val 2 rule 1 rule 2 rule 3 rule 4 Root Leaf Sub-Goal

17 17 V4: income gV2: approved rule 2 gV1: denied rule 1 V2: credit rating V3: in job at least 25K excellentgoodpoor less then 2.5at least 2.5 less than 25K gV1: denied rule 3 gV2: approved rule 4 gV1: denied rule 5 KBS DECISION TREE 1-1 with rule-base (pseudo code) 1. IF The customer's income is less than 25,000. THEN The customer's line of credit is denied. 2. IFThe customer's income is at least 25,000. ANDThe customer's credit rating is excellent. THEN The customer's line of credit is approved. 3. IF The customer's income is at least 25,000. ANDThe customer's credit rating is good. ANDThe customer has been in their present job less than 2.5 years. THEN The customer's line of credit is denied. 4. IF The customer's income is at least 25,000. ANDThe customer's credit rating is good. AND The customer has been in their present job at least 2.5 years. THEN The customer's line of credit is approved. 5. IF The customer's income is at least 25,000. AND The customer's credit rating is poor. THEN The customer's line of credit is denied. Apply the definition!

18 18 HR Authorization Problem R1 - If the visitor’s hotel type is C then the price of the hotel type is less than $50 R2 - If the visitor’s hotel is B then the price of the hotel type is between $50 and $100 R3 - If the visitor’s hotel type is A then the price of the hotel is greater than $100. R4 - If the visitor’s hotel type is AA then the price of the hotel is greater than $100. R5 - If the visitor’s job title is director then the hotel reservation is approved R6 -If the visitor’s job title is senior manager and the price of the hotel is greater than $100 and the visitor’s department is Accounting then the hotel reservation is approved R7 - If the visitor’s job title is senior manager and the price of the hotel is greater than $100 and the visitor’s department is not Accounting then the hotel reservation is denied R8 - If the visitor’s job title is senior manager and the price of the hotel is between $50 and $100 then the hotel reservation is approved R9 - If (the visitor’s job title is senior manager or the visitor’s job title is junior manager and the price of the hotel is less than $50 then the hotel reservation is approved. R10 - If the visitor’s job title is junior manager and the price of the hotel is greater or equal $50 then the hotel reservation is denied Handout!

19 19 EXSYS Goal Variables and values: 1.The hotel reservation is approved. 2.The hotel reservation is denied. EXSYS Variables and Values 1.The visitors hotel type is 1.C 2.B 3.A 4.AA 2.The visitors job title is 1.director 2.senior manager 3.junior manager DICTIONARY/GLOSSARY! 3.The price of the hotel is 1.greater than $100 (> 100) 2.between $50 and $100 (> =50 and < =100) 3.greater than or = $50 (>=50) 4.less than $50 (< 50) 4.The visitors department is 1.accounting 2.not accounting

20 20 Example KBS Decision Tree Hotel Reservation Authorization Hotel type Hotel Price is < $50 R1 C R1 - If the visitor’s hotel type is C then the price of the hotel type is less than $50 R2 - If the visitor’s hotel is B then the price of the hotel type is between $50 and $100 R3 - If the visitor’s hotel type is A then the price of the hotel is greater than $100. R4 - If the visitor’s hotel type is AA then the price of the hotel is greater than $100. Hotel type B Hotel Price is > $50 and < $100 R2 Hotel type Hotel Price is > $100 R3 A Hotel type AA Hotel Price is > $100 R 4

21 21 HR Authorization Problem R1 - If the visitor’s hotel type is C then the price of the hotel type is less than $50 R2 - If the visitor’s hotel is B then the price of the hotel type is between $50 and $100 R3 - If the visitor’s hotel type is A then the price of the hotel is greater than $100. R4 - If the visitor’s hotel type is AA then the price of the hotel is greater than $100. R5 - If the visitor’s job title is director Then the hotel reservation is approved R6 -If the visitor’s job title is senior manager and the price of the hotel is greater than $100 and the visitor’s department is Accounting then the hotel reservation is approved R7 - If the visitor’s job title is senior manager and the price of the hotel is greater than $100 and the visitor’s department is not Accounting then the hotel reservation is denied R8 - If the visitor’s job title is senior manager and the price of the hotel is between $50 and $100 then the hotel reservation is approved R9 - If the visitor’s job title is senior manager or the visitor’s job title is junior manager and the price of the hotel is less than $50 then the hotel reservation is approved. R10 - If the visitor’s job title is junior manager and the price of the hotel is greater or equal $50 then the hotel reservation is denied

22 22 EXSYS Goal Variables and values: 1.The hotel reservation is approved. 2.The hotel reservation is denied. EXSYS Variables and Values 1.The visitors hotel type is 1.C 2.B 3.A 4.AA 2.The visitors job title is 1.director 2.senior manager 3.junior manager DICTIONARY/GLOSSARY! 3.The price of the hotel is 1.greater than $100 (> 100) 2.between $50 and $100 (> =50 and < =100) 3.greater than or = $50 (>=50) 4.less than $50 (< 50) 4.The visitors department is 1.accounting 2.not accounting

23 23 Reverse Engineering: From Rules to Decision Tree R5: If the visitor’s job title is director Then the hotel reservation is approved Job Title HR is approved R5 Director

24 24 Reverse Engineering: From Rules to Decision Tree Hotel Price Senior Manager >100 Visitor Dept. Accounting HR is approved R6 R6: If the visitor’s job title is senior manager and the price of the hotel is greater than $100 and the visitor’s department is Accounting Then the hotel reservation is approved Job Title HR is approved R5 Director

25 25 Reverse Engineering: From Rules to Decision Tree Job Title HR is approved R5 Director Hotel Price Senior Manager >100 Visitor Dept. Accounting HR is approved R6 R7: If the visitor’s job title is senior manager and the price of the hotel is greater than $100 and the visitor’s department is not Accounting Then the hotel reservation is denied ot Accounting HR is denied R7

26 26 Reverse Engineering: From Rules to Decision Tree Job Title HR is approved Director Hotel Price Senior Manager >100 Visitor Dept. Accounting HR is approved R6 R8: If the visitor’s job title is senior manager and the price of the hotel is between $50 and $100 Then the hotel reservation is denied Not Accounting HR is denied R7 >=50 and <=100 HR is approved R8 HR is approved R5

27 27 Reverse Engineering: From Rules to Decision Tree Job Title HR is approved R5 Director Hotel Price Senior Manager >100 Visitor Dept. Accounting HR is approved R6 R9: If the visitor’s job title is senior manager and the price of the hotel is less than $50 Then the hotel reservation is approved Not Accounting HR is denied R7 >=50 and <=100 HR is approved R8 <50 HR is approved R9 R9 - If the visitor’s job title is senior manager the visitor’s job title is junior manager and the price of the hotel is less than $50 Then the hotel reservation is approved. OR

28 28 Reverse Engineering: From Rules to Decision Tree Job Title HR is approved R5 Director Hotel Price Senior Manager >100 Visitor Dept. Accounting HR is approved R6 Not Accounting HR is denied R7 >=50 and <=100 HR is approved R8 <50 HR is approved R9 <50 Junior Manager Hotel Price <50 HR is approved R10 >=50 HR is denied R11 R11 - If the visitor’s job title is junior manager and the price of the hotel is equal to or greater than $50 then the hotel reservation is denied R10 - If the visitor’s job title is junior manager and the price of the hotel is less than $50 then the hotel reservation is approved. Note: the Rule base has changed! R9 - If the visitor’s job title is senior manager OR the visitor’s job title is junior manager and the price of the hotel is less than $50 Then the hotel reservation is approved.

29 29 R1 - If the visitor’s hotel type is C then the price of the hotel type is less than $50 R2 - If the visitor’s hotel is B then the price of the hotel type is between $50 and $100 R3 - If the visitor’s hotel type is A then the price of the hotel is greater than $100. R4 - If the visitor’s hotel type is AA then the price of the hotel is greater than $100. R5 - If the visitor’s job title is director Then the hotel reservation is approved R6 -If the visitor’s job title is senior manager and the price of the hotel is greater than $100 and the visitor’s department is Accounting then the hotel reservation is approved Reverse Engineering: Revised From Rule to Decision Tree(s) R7 - If the visitor’s job title is senior manager and the price of the hotel is greater than $100 and the visitor’s department is not Accounting then the hotel reservation is denied R8 - If the visitor’s job title is senior manager and the price of the hotel is between $50 and $100 then the hotel reservation is approved R9 - If the visitor’s job title is senior manager and the price of the hotel is less than $50 then the hotel reservation is approved. R10 - If visitor’s job title is junior manager and the price of the hotel is less than $50 then the hotel reservation is approved. R11 - If the visitor’s job title is junior manager and the price of the hotel is greater or equal $50 then the hotel reservation is denied

30 30 Verifying the Acquired Knowledge Using the DT, the expert’s knowledge is easy to check Incompleteness in a knowledge-base Check whether there are some branches of a tree that are missing Minimal Quick Fix for an incomplete knowledge- base “This line of reasoning is under construction.”

31 31 Example KBS Decision Tree Hotel Reservation Authorization What if the Job Title is not Director, Senior Manager or Junior Manager? HR is undecided, call your supervisor Others Job Title HR is approved R5 Director Hotel Price Senior Manager >100 Visitor Dept. Accounting HR is approved R6 Not Accounting HR is denied R7 >=50 and <=100 HR is approved R8 <50 HR is approved R9 Junior Manager Hotel Price <50 HR is approved R10 >=50 HR is denied R11 Again, the rule base must change

32 32 Example KBS Decision Tree Hotel Reservation Authorization Other (BA) HR is denied Rule? Our Department has submitted a HR for a different type of Hotel, BA. How does the HRA handle this ? Hotel Hotel Price is $45 Rule 1 C B AA Hotel Price is $75 Rule 1 Hotel Price is $120 Rule 3 A Hotel Price is $250 Rule 4

33 33 Example KBS Decision Tree Hotel Reservation Authorization Lab 1: Enter this into EXSYS Corvid. Prep to Lab 1: Walk though how to use Corvid using the Credit example. Hotel type Hotel Price is $45 Rule 1 C B AA Hotel Price is $75 Rule 1 Hotel Price is $120 Rule 3 A Hotel Price is $250 Rule 4 Job Title HR is approved R5 Director Hotel Price Senior Manager Visitor Dept. Accounting HR is approved R6 Not Accounting HR is denied R7 >=50 and <=100 HR is approved R8 <50 HR is approved R9 Junior Manager Hotel Price <50 HR is approved R10 >=50 HR is denied R11 <=100


Download ppt "1 ISAT 252: Analytical Methods IV Knowledge-Based Systems (KBS) and Declarative Programming KBS development and KBSDT Details Reading Assignment: Corvid."

Similar presentations


Ads by Google