Top Banner
1 ISAT 252:Analytical Methods IV ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS) and Declarative programming Reading Assignment1 What are Expert Systems?
21

ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS) and

Jan 25, 2016

Download

Documents

makoto

ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS) and Declarative programming Reading Assignment1 What are Expert Systems?. Declarative Programming Module Objectives:. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

1

ISAT 252:Analytical Methods IVISAT 252:Analytical Methods IV

Introduction to Expert/Knowledge-Based

Systems (EKBS) and

Declarative programming

Reading Assignment1What are Expert Systems?

Page 2: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

2

Declarative Programming Module Objectives:

• To be able to explain how the declarative programming differs from other programming paradigms, describe the role of logic in declarative programming, and describe how to use and use a EKBS shell in a declarative programming project application;

• To be able to define a KBS and an ES, describe the human resources and roles required to build a KBS, and describe the architecture, components, a methodology, and programming constructs used, to build a KBS;

• To (be able to) build a KBS that illustrates all of the objectives mentioned above; that is, to develop the skills required to build a KBS, through the experience of designing and developing a KBS in a KBS shell.

Page 3: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

3

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

4. Lecture 4: Inference engines and search algorithms*

Page 4: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

4

Lecture 1: Introduction to KBS and declarative programming

Distinguish two Programming Paradigms:• procedural programming• declarative programming

Explain the role of logic in programming, in particular in declarative programming• master the truth table definition of a “valid

rule of inference”• Apply the truth table definition of valid

inference to distinguish between examples of valid and invalid inferences.

Page 5: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

5

Programming paradigmsProgramming paradigms

in the procedural programming paradigm: a program (code) provides the computer a

procedure, i.e., an ordered sequence of steps to be executed, in order, one step at a time.

for example, a procedure (algorithm) can be specified to process a payroll.

commercial applications and successes: COBOL: business programming FORTRAN: scientific programming C, … VB (various versions) and C++ have

procedural components

Page 6: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

6

Procedural KnowledgeProcedural Knowledge

Procedural Knowledge is knowing how to do something. The solution to problems that require procedural knowledge can be express with an Algorithm

Where an Agorithm is a logical and finite sequence of precise steps leading to the solution of the problem

Definition of Procedural Knowledge (Fox) A person x knows how to q if and only if

the procedure q is correct: that is, if x follows q, x gets a ... (cake baked, pay role paid, house built …)

x is minimally competent to q: that is, under appropriate circumstances, with appropriate tools, ...

Page 7: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

7

Procedural Knowledge ExampleProcedural Knowledge Example

Problem: How to replace a light bulb in a lamp

Solution Algorithm

1. Find a new light bulb

2. Turn off the lamp

3. Take out the old light bulb from the lamp

4. Put in the new light bulb

5. Turn on the lamp

6. If the light bulb does not work, repeat from 1, otherwise stop

Page 8: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

8

Problem: process a payroll

Algorithm:For each employee card

1. Determine hours worked during the pay period.

2. Multiply by dollars/hour to determine gross pay.

3. Calculate and subtract appropriate taxes and withholding.

4. Print a check for the net pay for the employee in the current card .

5. Update the employee card.

6. Continue (loop) until all employees cards are processed.

Procedural Knowledge ExampleProcedural Knowledge Example

Page 9: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

9

Declarative Knowledge Declarative Knowledge Declarative knowledge is knowledge about things, that something is

the case, about “facts” and relationships among facts, for example, Water is made up of hydrogen and oxygen, H2O. 2 + 2 = 4 If you heat water it will boil. If Cleopatra is a women and all women are mortal than Cleopatra is

mortal

By definition, declarative knowledge cannot be FALSE! We cannot know that 2 + 2 = 5 or that the Sun revolves around the Earth, although some of us might have once held the former belief and many the latter.

The classical and arguable still the best definition (understanding) of Declarative Knowledge comes from Plato:

A person x knows that p if and only if x believes that p p is true x is justified in believing that p

Page 10: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

10

Example of Declarative Knowledge: Example of Declarative Knowledge: Family/Kinship Relationships Family/Kinship Relationships

Facts: Mary is the mother of Bill, Anne is the mother of Mary,… Robert is Mary’s brother

Relationships: A person is a grandmother whenever she is the

mother of another person who is either a mother or a father .

A person is a grandfather whenever he is the father of another person who is either a mother or a father.

A person is a son of another person whenever the other person is his/her mother

A person is an uncle whenever that person is the brother of a person who has either a father or a mother

……..

Tell me something that is not explicitly stated but that follows from what we have here.

How did you (do we) do this and how do you know that you got it right?

This is the ability that we want to capture, automate, compute, i.e., the human ability to reason.

Page 11: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

11

Programming paradigms cont.Programming paradigms cont.

Declarative programming (vs. procedural programming):

The program describes to the computer a set of conditions/ relationships among the facts, concepts and description of a problem

The computer finds the solution by making logic inferences from the facts and relationships provided in the program

Used to formulate and solve problems historically identified with artificial intelligence applications.

Also called Symbolic Programming or Logic Programming

Page 12: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

12

Programming paradigmsProgramming paradigms Declarative programming:

Some typical applications http://www.exsys.com/case2.html diagnostic system, e.g., which infectious disease is implicated by the evident symptoms.

Configuration systems, e.g., the computing system discussed earlier in the semester …

Decision support systems, e.g. what CISAT computing equipment to replace with this years budget.

KBS Environments KBS Shells and Programming Environments: built to

facilitate this type of problem solving EXSYS Corvid (OPS 5)

Special symbolic/reasoning programming languages PROLOG LISP can be use to build diagnostic system,

configuration systems, decision support systems, etc..

Page 13: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

13

Cyril [5, 15]

John [10, 12, 14]

Mario [4, 16]

[8, 13, 11,14]

Example: Identifying suspects in a Example: Identifying suspects in a crimecrime

1. Suzie is the victim

2. Suspects ?

3. Suzie was killed with a blunt instrument.

4. Mario knew Suzie.

5. Cyril is covered in blood.

6. Mario is covered in mud.

7. Cyril is a butcher.

8. Mario is a footballer.

9. John is a carpenter.

10. John has a wooden leg.

11. If the subject has a football boot then (s)he has a blunt instrument.

12. If the subject has a wooden leg then (s)he has a blunt instrument.

13. If the subject is a footballer then (s)he has football boots.

14. If the subject has a blunt instrument then (s)he is suspect

15. If the subject is covered with blood then (s)he is a suspect .

16. If the subject knew the victim then (s)he is suspect.

Suzie is the victim. Mario is the prime suspect!

Suspects? Why?

Cyril

John

Mario

rio

Page 14: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

14

KBS use an KBS use an inference engineinference engine (built on valid rules of (built on valid rules of inference) to infer conclusions. What is a valid rule of inference) to infer conclusions. What is a valid rule of inference?inference?

By definition, a valid rule of inference guarantees that if the statements (premises) to which the rule is applied are true, (correct) then the conclusion of the rule must be true (correct).

For example, (paraphrasing the set of examples found above): If Mario knew Suzie then Mario is a suspect. Mario knew Suzie. Therefore, Mario is a suspect.

If Cyril is covered in blood then Cyril is a suspect.Cyril is covered in blood.Therefore, Cyril is a suspect.

Intuitively, these are paradigmatic examples of validity. We share the recognition that if their premises are true, their conclusions must be true. The formal definition of “validity” must account for these, and other, examples.

Page 15: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

15

Knowledge is inferred by applying/using valid rules of inference on the facts and relationships

A valid rule of inference GUARANTEES that if the statements (premises) to which the rule is applied are true, the conclusion must be true. Consider another example:

What rule(s) of inference guarantees this?

Rules of InferencesRules of Inferences

If Anne is the mother of Mary and Premise

Mary is the mother of Bill then

Anne is the grandmother of Bill

Anne is the mother of MaryPremise

Mary is the mother of Bill Premise

Therefore Anne is the grandmother of BillConclusion

Page 16: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

16

MODUS PONENS is the most common rule of inference, that is, the most common rule for playing the “game of logic”

Modus Ponens is intuitively a valid rule of inference : The conclusion cannot be false, if the statements

to which the rule is applied are True. How can we establish this?

Rules of Inference: Modus Ponens

Premises

Let P be a statement and P Q be a conditional statement

If P then Q P Q (TRUE)

P P (TRUE)By MP Q Q(TRUE)

Conclusion

Page 17: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

17

Let X and Y be variables for declarative statements; by definition statements are either TRUE or FALSE

By definition Truth Tables determine the truth values of combination of statements as follows:

- X

NOT X

FALSEFALSETRUETRUE

X Y

TRUE TRUETRUE FALSEFALSE TRUEFALSE FALSE

X ^ Y

X AND Y TRUEFALSEFALSEFALSE

X v Y

X OR Y TRUE TRUE TRUE FALSE

X Y

IF X THEN Y

TRUEFALSETRUETRUE

Modus Ponens: Rule of Inference

How can we use this to establish MP as a Valid Rule of Inference ?

Page 18: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

18

P P Q/ Q

COMPONENTS PREM PREM CONCLUSION

P

TRUETRUEFALSEFALSE

P Q

TRUE TRUETRUE FALSEFALSE TRUEFALSE FALSE

Q

TRUEFALSETRUEFALSE

P Q

TRUEFALSETRUETRUE

Modus Ponens

Whenever P is TRUE and P Q is TRUE (IF P Then Q is TRUE)

Q is TRUE

Alternatively, if Q is FALSE, either P or P Q is FALSE

Therefore, Modus Ponens is a valid rule of inference

Page 19: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

19

PREM PREM CONCLUSION

A F D A AND F IF (A AND F) THEN D NOT D

Page 20: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

20

PREM PREM CONCLUSION

A F D A AND F IF (A AND F) THEN D NOT D

T T T

T T F

T F T

T F F

F T T

F T F

F F T

F F F F T T

F T F

F T T

F T F

F T T

F T F

T F T

T T F

Page 21: ISAT 252:Analytical Methods IV Introduction to Expert/Knowledge-Based Systems (EKBS)  and

21

KBS Homework1TT analysis to reinforce understanding the definition of a valid argument

Rule 1: If A and (A and F) D are premises

Then D is a valid conclusion

Rule 2: If (NOT A) and (A F) are premises

Then NOT F is a valid conclusion

Rule 3: If A and (A or F) D are premises

Then D is a valid conclusion

Rule 4: If A v F and A D are premises

Then D is a valid conclusion