1 / 33

ISAT 252 : Analytical Methods IV Knowledge-Based Systems (KBS) and Declarative Programming

ISAT 252 : Analytical Methods IV Knowledge-Based Systems (KBS) and Declarative Programming KBS development and KBSDT Details Reading Assignment : Corvid Quick Start Manual. Outline. Lecture 1:Introduction to KBS and declarative programming

magda
Télécharger la présentation

ISAT 252 : Analytical Methods IV Knowledge-Based Systems (KBS) and Declarative Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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. Outline • Lecture 1:Introduction to KBS and declarative programming • Lecture 2: Knowledge-based systems (KBS): definition and requirements overview • Lecture 3: KBS development and programming details • Examples • Snow board package • Guitar selection • Auto audio system

  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. KBS Development Methodology Cycle • 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. define problem & goals design & construct prototype test/use system analyze & correct design assumption correct? no failed yes ready for final evaluation? final evaluation no yes passed

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

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

  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. Knowledge-based systems development Step 2: design & prototype construction • 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. define problem & goals design & construct prototype test/use system analyze & correct design assumption correct? no failed yes ready for final evaluation? final evaluation no yes passed

  9. Knowledge-based systems development Steps 3 - 7: 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 define problem & goals design & construct prototype test/use system analyze & correct design assumption correct? no failed yes ready for final evaluation? final evaluation no yes passed

  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: • knowledge acquisition - acquiring the knowledge about the subject matter domain; • knowledge representation - representing the knowledge such that it can be used by the humans involved and the computer system; • prototype design - that is, designing a solution that the client is OK with – show the client; • programming - that is, entering the knowledge-base into the system (coding the prototype) – show the client.

  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. PSEUDO CODE RULES PCR the language in the GLS! 1. IF The customer's income isless than 25,000. THEN The customer's line of credit is denied. 2. IF The customer's income isat least 25,000. AND The customer's credit rating isexcellent. THEN The customer's line of credit is approved. 3. IF The customer's income isat least 25,000. AND The customer's credit ratingis good. AND The customer has been in their present jobless than 2.5 years. THEN The customer's line of credit is denied. 4. IF The customer's income isat least 25,000. AND The customer's credit rating isgood. AND The customer has been in their present jobat least 2.5 years. THEN The customer's line of credit is approved. 5. IF The customer's income isat least 25,000. ANDThe customer's credit rating ispoor. THENThe customer's line of credit is denied. EXSYS Corvid variables values goal-variables

  13. KBS Assistant: DICTIONARY/GLOSSARY! • CORVID Goals: • gV1: The customer's line of credit is • approved. • denied. • CORVID Variables and VALUES: • V2: The customer's credit rating is • excellent. • good. • poor. • V3: The customer has been in their present job • less than 2.5 years. • at least 2.5 years. • V4: The customer's income is • less than 25,000. • at least 25,000. 1. IF The customer's income isless than 25,000. THEN The customer's line of credit is denied. 2. IF The customer's income isat 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.

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

  15. KBS Assistant: DICTIONARY/GLOSSARY! • CORVID Goals: • gV1: The customer's line of credit is • approved. • denied. • CORVID Variables and VALUES: • V2: The customer's credit rating is • excellent. • good. • poor. • V3: The customer has been in their present job • less than 2.5 years. • at least 2.5 years. • V4: The customer's income is • less than 25,000. • at least 25,000. 1. IF The customer's income isless than 25,000. THEN The customer's line of credit is denied. 2. IF The customer's income isat 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.

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

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

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

  20. Example KBS Decision Tree Hotel type Hotel type Hotel type Hotel type AA C B A Hotel Price is < $50 R1 Hotel Price is >$100 R3 Hotel Price is > $50 and < $100 R2 Hotel Price is >$100 R 4 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 Reservation Authorization

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

  23. Reverse Engineering:From Rules to Decision Tree Job Title Director HR isapproved R5 R5: Ifthe visitor’s job title isdirector Thenthe hotel reservation isapproved

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

  25. Reverse Engineering:From Rules to Decision Tree otAccounting HR isdenied R7 Job Title Director Senior Manager HR isapproved R5 Hotel Price >100 Visitor Dept. Accounting HR isapproved R6 R7: Ifthe visitor’s job title issenior manager andthe price of the hotel isgreater than $100 andthe visitor’s departmentis notAccounting Thenthe hotel reservation isdenied

  26. Reverse Engineering:From Rules to Decision Tree >=50 and <=100 HR is approved R8 Job Title Director Senior Manager HR is approved HR isapproved R5 Hotel Price >100 Visitor Dept. Accounting Not Accounting HR is approved R6 HR isdenied R7 R8: Ifthe visitor’s job titleissenior manager andthe price of the hotelisbetween $50 and $100 Thenthe hotel reservation isdenied

  27. Reverse Engineering:From Rules to Decision Tree <50 HR isapproved R9 Job Title R9 - If the visitor’s job title issenior manager the visitor’s job title isjunior manager andthe price of the hotel isless than $50 Thenthe hotel reservation isapproved. OR Director Senior Manager HR isapproved R5 Hotel Price >100 >=50 and <=100 Visitor Dept. HR isapproved R8 Accounting Not Accounting HR isapproved R6 HR isdenied R7 R9: Ifthe visitor’s job title is senior manager andthe price of the hotel isless than $50 Thenthe hotel reservation isapproved

  28. Reverse Engineering:From Rules to Decision Tree Junior Manager Hotel Price >=50 <50 HR isdenied R11 HR isapproved R10 <50 <50 HR isapproved R9 R9 - If the visitor’s job title issenior manager ORthe visitor’s job title isjunior manager andthe price of the hotel isless than $50 Thenthe hotel reservation isapproved. Job Title Director Senior Manager HR isapproved R5 Hotel Price >100 >=50 and <=100 Visitor Dept. HR isapproved R8 Note: the Rule base has changed! Accounting Not Accounting R10 - Ifthe visitor’s job title isjunior manager andthe price of the hotel isless than $50 then the hotel reservation isapproved. HR isapproved R6 HR isdenied R7 R11 - Ifthe visitor’s job title isjunior manager and the price of the hotel isequal to orgreater than $50 thenthe hotel reservation isdenied

  29. 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 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

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

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

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

More Related