expert system seyed hashem davarpanah [email protected] university of science and culture

43
Expert System Expert System Seyed Hashem Davarpanah Seyed Hashem Davarpanah [email protected] University of Science and University of Science and Culture Culture

Upload: noah-lindsey

Post on 26-Mar-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Expert SystemExpert System

Seyed Hashem DavarpanahSeyed Hashem [email protected]

University of Science and University of Science and CultureCulture

Page 2: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Inexact ReasoningInexact Reasoning

References:References: Jackson, Chapter 19, Truth Maintenance SystemsJackson, Chapter 19, Truth Maintenance Systems Giarratano and Riley, Chapters 4 and 5 Giarratano and Riley, Chapters 4 and 5 Luger and Stubblefield 'Artificial Intelligence', Luger and Stubblefield 'Artificial Intelligence',

Addison-Wesley, 2002, Chapter 7Addison-Wesley, 2002, Chapter 7

Page 3: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Knowledge & Inexact Knowledge & Inexact ReasoningReasoning

inexact knowledge (truth of inexact knowledge (truth of not clear) not clear) incomplete knowledge (lack of incomplete knowledge (lack of

knowledge about knowledge about )) defaults, beliefs (assumption about truth defaults, beliefs (assumption about truth

of of )) contradictory knowledge (contradictory knowledge ( true and true and

false)false) vague knowledge (truth of vague knowledge (truth of not 0/1) not 0/1)

Page 4: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Inexact ReasoningInexact Reasoning Inexact ReasoningInexact Reasoning CF Theory - uncertaintyCF Theory - uncertainty

uncertainty about facts and conclusionsuncertainty about facts and conclusions Fuzzy - vaguenessFuzzy - vagueness

truth not 0 or 1 but graded (membership fct.)truth not 0 or 1 but graded (membership fct.)

Truth Maintenance - beliefs, Truth Maintenance - beliefs, defaultsdefaultsassumptions about facts, can be revisedassumptions about facts, can be revised

Probability Theory - likelihood of Probability Theory - likelihood of eventseventsstatistical model of knowledgestatistical model of knowledge

Page 5: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Inexact Reasoning not Inexact Reasoning not necessary ...necessary ...

NOT necessary when assuming:NOT necessary when assuming: complete knowledge about the "world"complete knowledge about the "world" no contradictory facts or rulesno contradictory facts or rules everything is either true or falseeverything is either true or false

This corresponds formally to a This corresponds formally to a complete consistent complete consistent theory in First-Order Logictheory in First-Order Logic, i.e., i.e.

everything you have to model is contained in the everything you have to model is contained in the theory, i.e. your theory or domain model is completetheory, i.e. your theory or domain model is complete

facts are true or false (assuming your rules are true)facts are true or false (assuming your rules are true) your sets of facts and rules contain no contradiction your sets of facts and rules contain no contradiction

(are consistent)(are consistent)

Page 6: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Exact Reasoning:Exact Reasoning: Theories in First-Order Predicate Theories in First-Order Predicate

LogicLogicTheory (Knowledge Base) given as a set of well-Theory (Knowledge Base) given as a set of well-formed formulae.formed formulae.

Formulae include Formulae include factsfacts like like mother (Mary, Peter)mother (Mary, Peter)

and and rulesrules like like mother (x, y) mother (x, y) child (y, x) child (y, x)

Reasoning based on applying rules of inference of Reasoning based on applying rules of inference of first-order predicate logic, like Modus Ponens:first-order predicate logic, like Modus Ponens:

IfIf p p and and ppqq given then given then qq can be inferred (proven) can be inferred (proven)

p, pq

q

Page 7: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Forms of Inexact KnowledgeForms of Inexact Knowledge

uncertainty uncertainty (truth not clear)(truth not clear) probabilistic models, multi-valued logic (true, false, probabilistic models, multi-valued logic (true, false,

don't know,...), certainty factor theorydon't know,...), certainty factor theory incomplete knowledgeincomplete knowledge (lack of knowledge) (lack of knowledge)

P true or false not known (P true or false not known ( defaults) defaults) defaults, beliefsdefaults, beliefs (assumptions about truth) (assumptions about truth)

assume P is true, as long as there is no counter-assume P is true, as long as there is no counter-evidence (i.e. that evidence (i.e. that ¬¬P is true)P is true)

assume P is true with Certainty Factorassume P is true with Certainty Factor contradictory knowledgecontradictory knowledge (true and false) (true and false)

inconsistent fact base; somehow P and inconsistent fact base; somehow P and ¬¬P trueP true vague knowledgevague knowledge (truth value not 0/1; not crisp sets) (truth value not 0/1; not crisp sets)

graded truth; fuzzy setsgraded truth; fuzzy sets

Page 8: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Inexact Knowledge - ExampleInexact Knowledge - Example

Person A walks on Campus towards the bus stop. A Person A walks on Campus towards the bus stop. A few hundred yards away A sees someone and is quite few hundred yards away A sees someone and is quite sure that it's his next-door neighbor B who usually sure that it's his next-door neighbor B who usually goes by car to the University. A screams B's name.goes by car to the University. A screams B's name.

default - A wants to take a bus

belief, (un)certainty - it's the neighbor B

probability, default, uncertainty - the neighbor goes home by car

default - A wants to get a lift

default - A wants to go home

Q: Which forms of inexact knowledge and reasoning are involved here?

Page 9: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Examples of Inexact KnowledgeExamples of Inexact Knowledge

Person A walks on Campus towards the bus stop. A Person A walks on Campus towards the bus stop. A few few hundredhundred yards away A sees someone and is quite sure yards away A sees someone and is quite sure that that it's his next-door neighbor Bit's his next-door neighbor B who who usually goes by usually goes by carcar to the University. A screams B's name. to the University. A screams B's name.

Fuzzy - a few hundred yardsdefine a mapping from "#hundreds" to 'few', 'many', ...not uncertain or incomplete but graded, vague

Probabilistic - the neighbor usually goes by carprobability based on measure of how often he takes car; calculates always p(F) = 1 - p(¬F)

Belief - it's his next-door neighbor B "reasoned assumption", assumed to be true

Default - A wants to take a bus assumption based on commonsense knowledge

Page 10: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Dealing with Inexact Dealing with Inexact KnowledgeKnowledge

Methods for Methods for representingrepresenting and and handlinghandling::1.1. incomplete knowledge: defaults, beliefsincomplete knowledge: defaults, beliefs

Truth Maintenance Systems (TMS); non-monotonic Truth Maintenance Systems (TMS); non-monotonic reasoningreasoning

2.2. contradictory knowledge: contradictory facts or contradictory knowledge: contradictory facts or different conclusions, based on defaults or beliefs different conclusions, based on defaults or beliefs TMS, Certainty Factors, ... , multi-valued logicsTMS, Certainty Factors, ... , multi-valued logics

3.3. uncertain knowledge: hypotheses, statistics uncertain knowledge: hypotheses, statistics Certainty Factors, Certainty Factors, Probability TheoryProbability Theory

4.4. vague knowledge: "graded" truthvague knowledge: "graded" truth Fuzzy, rough sets Fuzzy, rough sets

5.5. inexact knowledge and reasoninginexact knowledge and reasoning involves 1-4; clear 0/1 truth value cannot be assignedinvolves 1-4; clear 0/1 truth value cannot be assigned

Page 11: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Truth Truth Maintenance Maintenance

SystemsSystems

Page 12: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Truth MaintenanceTruth Maintenance

Necessary when changes in the fact-base Necessary when changes in the fact-base lead to inconsistency / incorrectness among lead to inconsistency / incorrectness among the facts the facts non-monotonic reasoningnon-monotonic reasoning

A A TTruthruth M Maintenanceaintenance S System tries to adjust ystem tries to adjust the Knowledge Base or Fact Base upon the Knowledge Base or Fact Base upon changes to keep it consistent and correct. changes to keep it consistent and correct.

A TMS uses A TMS uses dependenciesdependencies among factsamong facts to to keep track of conclusions and allow keep track of conclusions and allow revision revision / retraction of facts and conclusions/ retraction of facts and conclusions..

Page 13: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Non-monotonic ReasoningNon-monotonic Reasoning

non-monotonic reasoningnon-monotonic reasoning The set of currently valid (believed) facts does The set of currently valid (believed) facts does

NOT increase monotonically.NOT increase monotonically. Adding a new fact might lead to an Adding a new fact might lead to an

inconsistency which requires the removal of inconsistency which requires the removal of one of the contradictory facts.one of the contradictory facts.

Thus, the set of true (or: believed as true) facts Thus, the set of true (or: believed as true) facts can shrink and grow with reasoning. can shrink and grow with reasoning.

This is why it’s called “non-monotonic This is why it’s called “non-monotonic reasoning”.reasoning”.

In classical logic (first-order predicate logic) In classical logic (first-order predicate logic) this does not happen. Once a fact is asserted, this does not happen. Once a fact is asserted, it’s forever true.it’s forever true.

Page 14: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Non-monotonic Reasoning - Non-monotonic Reasoning - ExampleExample

Example:Example: non-monotonic reasoningnon-monotonic reasoning

Your are a student, it's 8am Your are a student, it's 8am , you are in bed., you are in bed.

You slip out of your dreams and think: Today is Sunday. No You slip out of your dreams and think: Today is Sunday. No classes today. l don't have to get up. You go back to sleep.classes today. l don't have to get up. You go back to sleep.

You wake up again. It's 9:30am You wake up again. It's 9:30am now and it is slowly coming now and it is slowly coming to your mind: Today is Tuesday. What an unpleasant surprise.to your mind: Today is Tuesday. What an unpleasant surprise.

P1 = today-is-Tuesday P2 = today-is-Sunday P3 = have-class-at-10am P4 = no-classesP5 = have-to-get-up P6 = can-stay-in-bed

Page 15: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

P1 P3 P5

P2 P4 P6

assume P2; conclude P1 ; P4 ; P3 ; P6 ; P5

assume P1; conclude P2 ; P3 ; P4 ; P5 ; P6

Non-monotonic Reasoning - Non-monotonic Reasoning - ExampleExample

P1 = today-is-Tuesday P2 = today-is-Sunday P3 = have-class-at-10am P4 = no-classesP5 = have-to-get-up P6 = can-stay-in-bed

Assume: P1 and P2, P3 and P4, P5 and P6 are mutually exclusive, i.e.

P1 P2, P3 P4, P5 P6

Page 16: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Truth Maintenance TheoriesTruth Maintenance Theories

TMS are often based on dependency-directed TMS are often based on dependency-directed backtracking to the point in reasoning where a wrong backtracking to the point in reasoning where a wrong assumption was used. assumption was used.

McAllester (1978,1980)McAllester (1978,1980)

““propositional constraint propagation”propositional constraint propagation”

employs a dependency network which employs a dependency network which reflects the justification of conclusions of reflects the justification of conclusions of new factsnew facts

Doyle (1979)Doyle (1979)

justification based Truth Maintenance Systemjustification based Truth Maintenance System

Page 17: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Truth Maintenance Theories - Truth Maintenance Theories - McAllesterMcAllester

McAllester “propositional constraint propagation”McAllester “propositional constraint propagation” network representing conclusions, network representing conclusions,

where where proposition-nodes are connected if one proposition-nodes are connected if one

of the nodes is a reason for concluding of the nodes is a reason for concluding the other node.the other node.

Example: Example: pq (pq)

If p is known to be true, q can be concluded.

Connections from p and pq to q mean that p and pq are reasons to conclude p.

Page 18: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Truth Maintenance Theories - Truth Maintenance Theories - McAllesterMcAllester

McAllester (1980) McAllester (1980) proposition-nodes are connected if one of the nodes proposition-nodes are connected if one of the nodes is a reason for concluding the other node is a reason for concluding the other node ((simplified simplified versionversion).).

Example:Example: Connections from Connections from pp and and ppqq to combination and to combination and then to then to qq represent represent justificationjustification forfor qq

p

p q

qp q

p

Page 19: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Truth Maintenance Theories - Truth Maintenance Theories - DoyleDoyle

Doyle (1979)Doyle (1979)

deals with beliefs as deals with beliefs as justifiedjustified assumptionsassumptions..

As long as there is no contra-evidence for a fact As long as there is no contra-evidence for a fact (belief) we can assume that it is true.(belief) we can assume that it is true.

ININpp facts which support P;facts which support P; OUTOUTp p facts which prevent P.facts which prevent P.

DistinguishesDistinguishes:: Premises - always true (Premises - always true (ININpp == OUTOUTp p == ))

Deductions - derived (Deductions - derived (ININpp ;; OUTOUTp p == ))

Assumptions – depends (Assumptions – depends (ININpp == ;; OUTOUTp p ))

Page 20: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Truth Maintenance Theories - Truth Maintenance Theories - DoyleDoyle

Doyle (1979)Doyle (1979)

As long as there is no contra-evidence for a fact As long as there is no contra-evidence for a fact (belief) we can assume that it is true.(belief) we can assume that it is true.

Theory is based on the concept of Theory is based on the concept of Support-ListsSupport-Lists ((SLSL).).

A A Support-ListSupport-List of a Fact (Belief) of a Fact (Belief) PP specifies Facts specifies Facts (Beliefs) which (Beliefs) which supportsupport the conclusion of the Fact the conclusion of the Fact PP or or preventprevent its conclusion. its conclusion.

The TMS maintains and updates the set of The TMS maintains and updates the set of current Facts/Beliefs if changes occur. Uses current Facts/Beliefs if changes occur. Uses justification networks, similar to McAllester’s justification networks, similar to McAllester’s dependency networks.dependency networks.

Page 21: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Certainty Factor Certainty Factor TheoryTheory

Page 22: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Certainty Factor TheoryCertainty Factor Theory

Certainty Factor Certainty Factor CFCF of Hypothesis H of Hypothesis H ranges between -1 (denial of H) and +1 ranges between -1 (denial of H) and +1

(confirmation of H)(confirmation of H) allows the ranking of hypothesesallows the ranking of hypotheses

Based on measures of belief Based on measures of belief MBMB and disbelief and disbelief MDMD MB is expressing the belief that H is trueMB is expressing the belief that H is true MD is expressing the belief that H is not trueMD is expressing the belief that H is not true MB is MB is notnot 1-MD - it’s not like probabilities 1-MD - it’s not like probabilities Experts determine values for MB, MD of H based Experts determine values for MB, MD of H based

on given evidence E on given evidence E subjective subjective

Page 23: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Stanford Certainty Factor Stanford Certainty Factor TheoryTheory

Certainty Factor Certainty Factor CFCF of Hypothesis of Hypothesis H H is based on is based on difference between Measure of Beliefdifference between Measure of Belief MB MB and and Measure of DisbeliefMeasure of Disbelief MD MD in hypothesis in hypothesis HH, given , given evidence evidence EE..

CCertainty ertainty FFactor of hypothesisactor of hypothesis H H given evidence given evidence EE::

CF (H|E) = MB(H|E) – MD(H|E) CF (H|E) = MB(H|E) – MD(H|E) -1 -1 CF(H) CF(H) 1 1

Can integrate different experts’ assessments.Can integrate different experts’ assessments.

Basis to combine support/rejection for H within Basis to combine support/rejection for H within one rule and using different rules.one rule and using different rules.

Page 24: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Stanford Certainty Factor Stanford Certainty Factor TheoryTheory

Remember the base rule for Certainty Factor Remember the base rule for Certainty Factor CF (H|E)CF (H|E) : :

CF (H|E)CF (H|E) = MB(H|E) – MD(H|E) -1 = MB(H|E) – MD(H|E) -1 CF(H) CF(H) 1 1

Integrate Certainty Factors into reasoning.Integrate Certainty Factors into reasoning. CF-value for H calculated using CFs of premises P in rule CF-value for H calculated using CFs of premises P in rule

CF(H) = CF(P1 CF(H) = CF(P1 andand P2) = P2) = minmin (CF(P1),CF(P2)) (CF(P1),CF(P2))

CF(H) = CF(P1 CF(H) = CF(P1 oror P2) = P2) = maxmax (CF(P1),CF(P2)) (CF(P1),CF(P2))

CF-value for H combined from different rules, experts, ...CF-value for H combined from different rules, experts, ...

CF(H) = CF1 + CF2 – CF1∙ CF2CF(H) = CF1 + CF2 – CF1∙ CF2if both if both CF1,CF2 CF1,CF2 > 0 > 0 CF(H) = CF1 + CF2 + CF1∙ CF2CF(H) = CF1 + CF2 + CF1∙ CF2 if both if both CF1,CF2 CF1,CF2 0 0 CF(H) = CF1 + CF2 CF(H) = CF1 + CF2 elseelse 1 – min ( |CF1|,|CF2| )1 – min ( |CF1|,|CF2| )

Page 25: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Characteristics of Certainty Characteristics of Certainty FactorsFactors

Aspect(Believed) Probability

MB MD CF

Certainly true P(H|E) = 1 1 0 1

Certainly false P(H|E) = 1 0 1 -1

No evidence P(H|E) = P(H) 0 0 0

RangesRangesmeasure of beliefmeasure of belief 0 ≤ 0 ≤ MBMB ≤ 1 ≤ 1

measure of disbeliefmeasure of disbelief 0 ≤ 0 ≤ MDMD ≤ 1 ≤ 1

certainty factor certainty factor -1 ≤ -1 ≤ CFCF ≤ +1 ≤ +1

Page 26: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Probability Probability TheoryTheory

Page 27: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Basics of Probability TheoryBasics of Probability Theory mathematical approach to process uncertain mathematical approach to process uncertain

informationinformation

sample space (event) setsample space (event) set: S = {x: S = {x11, x, x22, …, x, …, xnn}} collection of all possible eventscollection of all possible events

probabilityprobability p(x p(xii) is likelihood that the event x) is likelihood that the event xiiS S occursoccurs non-negative values in [0,1]non-negative values in [0,1] total probability of the sample space total probability of the sample space is 1, is 1, p(x p(xi i , x, xiiS) = 1S) = 1 experimental probabilityexperimental probability

based on the frequency of eventsbased on the frequency of events subjective probability (CF Theories, like Dempster-subjective probability (CF Theories, like Dempster-

Shafer, ...)Shafer, ...) based on expert assessmentbased on expert assessment

Page 28: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Compound ProbabilitiesCompound Probabilities for for independentindependent events events

do not affect each other in any waydo not affect each other in any way example: cards and events “hearts” and “queen”example: cards and events “hearts” and “queen”

jointjoint probability of independent events A and B probability of independent events A and B P(A P(A B) B) = |A = |A B| / |S| = P(A) * P(B) B| / |S| = P(A) * P(B)

where |S| is the number of elements in Swhere |S| is the number of elements in S unionunion probability of independent events A and B probability of independent events A and B

P(A P(A B) B) = P(A) + P(B) - P(A = P(A) + P(B) - P(A B) B) = P(A) + P(B) - P(A) * P (B)= P(A) + P(B) - P(A) * P (B)

Situation in which either event occurs. Subtract probability of Situation in which either event occurs. Subtract probability of their accidental co-occurrence - P(A their accidental co-occurrence - P(A B) is already included B) is already included in P(A)+P(B) and would otherwise be counted twice. in P(A)+P(B) and would otherwise be counted twice.

Page 29: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Compound ProbabilitiesCompound Probabilities

For For mutually exclusivemutually exclusive events events can not occur together at the same timecan not occur together at the same time Examples: one dice and events “1” and “6”; one Examples: one dice and events “1” and “6”; one

coin and events “heads” and “tail”coin and events “heads” and “tail” jointjoint probability of two different events A and probability of two different events A and

BB P(A P(A B) B) = 0= 0

Throw dice and show both “1” and “6” cannot happen.Throw dice and show both “1” and “6” cannot happen. unionunion probability of two events A and B probability of two events A and B

P(A P(A B) B) = P(A) + P(B)= P(A) + P(B)Throw coin and show either “heads” or “tail”.Throw coin and show either “heads” or “tail”.

This is also called “special addition”.This is also called “special addition”.

Page 30: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Conditional ProbabilitiesConditional Probabilities

describes describes dependentdependent events events affect each other in some wayaffect each other in some way

Example: Throw dice twice; second throw Example: Throw dice twice; second throw has to give larger value than first throw.has to give larger value than first throw.

conditional probabilityconditional probability of event A given that event B has already of event A given that event B has already occurredoccurred

P(A|B)P(A|B) = P(A = P(A B) / P(B) B) / P(B) example: B = throw(x); A = throw(y>x)example: B = throw(x); A = throw(y>x)

See next slide.See next slide.

Page 31: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Conditional ProbabilitiesConditional Probabilities Example: Example: B = throw(x); A = throw(y>x)B = throw(x); A = throw(y>x)

P(A|B) = P(throw x and then throw y with y>x) P(A|B) = P(throw x and then throw y with y>x)

P(A|B) = P(A P(A|B) = P(A B) / P(B) B) / P(B)

P(A P(A B) = P(throw x) B) = P(throw x) P(throw y, y>x) = 1/6 P(throw y, y>x) = 1/6 (1/6 (1/6 (6- (6-x)) x))

If x=5 then P(AIf x=5 then P(AB) = 1/6 B) = 1/6 1/6 1/6 (6-5) = 1/36 (6-5) = 1/36

If x=1 then P(AIf x=1 then P(AB) = 1/6 B) = 1/6 1/6 1/6 5 = 5/36 5 = 5/36 P(B) = P(throw x) = 1/6P(B) = P(throw x) = 1/6

P(A|B) = P(A P(A|B) = P(A B) / P(B) B) / P(B)

If x=1 then P(A|B) = 5/36*6 = 5/6 If x=1 then P(A|B) = 5/36*6 = 5/6 0.8... 0.8...

If x=5 then P(A|B) = 5/36*1 = 5/36 If x=5 then P(A|B) = 5/36*1 = 5/36 0.14 0.14

Page 32: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Bayesian ApproachesBayesian Approaches derive the probability of a cause given a derive the probability of a cause given a

symptomsymptom has gained importance recently due to has gained importance recently due to

advances in efficiencyadvances in efficiency more computational power availablemore computational power available better methodsbetter methods

especially useful in diagnostic systemsespecially useful in diagnostic systems medicine, computer help systemsmedicine, computer help systems

inverseinverse or or a posterioria posteriori probability probability inverse to conditional probability of an earlier event inverse to conditional probability of an earlier event

given that a later one occurredgiven that a later one occurred

Page 33: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Bayes’ Rule for Single Bayes’ Rule for Single EventEvent

single hypothesis H, single event Esingle hypothesis H, single event E

P(H | E) = (P(E | H) * P(H)) / P(E)P(H | E) = (P(E | H) * P(H)) / P(E)

oror

P(H | E) = (P(E | H) * P(H) / P(H | E) = (P(E | H) * P(H) / (P(E | H) * P(H) + P(E | (P(E | H) * P(H) + P(E | H) * H) * P(P(H) )H) )

Page 34: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

ExampleExample

Page 35: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Fred and the Cookie BowlsFred and the Cookie Bowls Suppose there are two bowls full of cookies. Suppose there are two bowls full of cookies. Bowl #1 has 10 chocolate chip cookies and 30 plain Bowl #1 has 10 chocolate chip cookies and 30 plain

cookies, while bowl #2 has 20 of each. cookies, while bowl #2 has 20 of each. Fred picks a bowl at random, and then picks a Fred picks a bowl at random, and then picks a

cookie at random. We may assume there is no cookie at random. We may assume there is no reason to believe Fred treats one bowl differently reason to believe Fred treats one bowl differently from another, likewise for the cookies. from another, likewise for the cookies.

The cookie turns out to be a plain one. The cookie turns out to be a plain one. How probable is it that Fred picked it out of bowl How probable is it that Fred picked it out of bowl

#1?#1?

From: http://en.wikipedia.org/wiki/Bayes'_theorem

Page 36: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

The Cookie Bowl ProblemThe Cookie Bowl Problem““What’s the probability that Fred picked bowl #1, given that he has a plain What’s the probability that Fred picked bowl #1, given that he has a plain

cookie?” cookie?”

EventEvent AA is that Fred picked is that Fred picked bowl #1bowl #1.. Event Event BB is that Fred picked a is that Fred picked a plain cookieplain cookie. . Compute Compute P(P(AA||BB)). We need:. We need:

P(P(AA)) - the probability that Fred - the probability that Fred picked bowl #1picked bowl #1 regardless of any regardless of any other information. Since Fred is treating both bowls equally, it is 0.5. other information. Since Fred is treating both bowls equally, it is 0.5.

P(P(BB)) is the probability of is the probability of getting a plain cookiegetting a plain cookie regardless of any regardless of any information on the bowls. It is computed as the sum of the probability information on the bowls. It is computed as the sum of the probability of getting a plain cookie from a bowl multiplied by the probability of of getting a plain cookie from a bowl multiplied by the probability of selecting this bowl. We know that the probability of selecting this bowl. We know that the probability of getting a plain getting a plain cookiecookie from from bowl #1 bowl #1 is is 0.750.75, and the probability of getting one from , and the probability of getting one from bowl #2bowl #2 is is 0.50.5. Since Fred is treating both bowls equally the . Since Fred is treating both bowls equally the probability of probability of selecting any one of the bowlsselecting any one of the bowls is is 0.5 0.5 (see next slide).(see next slide).

Thus, the Thus, the probability of getting a plain cookie overallprobability of getting a plain cookie overall is is 0.750.75××0.50.5 +  + 0.50.5××0.50.5 = = 0.6250.625. .

P(P(BB||AA)) is the probability of getting a is the probability of getting a plain cookie plain cookie given that Fred has given that Fred has selectedselected bowl #1 bowl #1. From the problem statement, we know this is. From the problem statement, we know this is 0.75 0.75, , since 30 out of 40 cookies in bowl #1 are plain. since 30 out of 40 cookies in bowl #1 are plain.

Page 37: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

The Cookie BowlsThe Cookie Bowls

Bowl #1 Bowl #2 Totals

Chocolate 10 20 30

Plain 30 20 50

Total 40 40 80

Bowl #1 Bowl #2 Totals

Chocolate 0.125 0.250 0.375

Plain 0.375 0.250 0.625

Total 0.500 0.500 1.000

The table on the right is derived from the table on the left by dividing each entry by the total

Number of cookies in each bowlby type of cookie

Relative frequency of cookies in each bowl

by type of cookie

Page 38: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Fred and the Cookie Fred and the Cookie BowlBowl

Given all this information, we can compute the Given all this information, we can compute the probability of Fred having selected bowl #1 (event A) probability of Fred having selected bowl #1 (event A) given that he got a plain cookie (event B), as such:given that he got a plain cookie (event B), as such:

As we expected, it is more than half.As we expected, it is more than half.

http://en.wikipedia.org/wiki/Bayes'_theorem

Page 39: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Fuzzy Set TheoryFuzzy Set Theory

Page 40: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Fuzzy Set Theory (Zadeh)Fuzzy Set Theory (Zadeh)

Aimed to model and formalize "Aimed to model and formalize "vaguevague" Natural " Natural Language terms and expressions.Language terms and expressions.

Example:Example: Peter is Peter is relatively tallrelatively tall..

DefineDefine a set of a set of fuzzyfuzzy setssets (predicates or categories), (predicates or categories), likelike talltall,, smallsmall..

Each fuzzy subset has an associated Each fuzzy subset has an associated membershipmembership functionfunction mapping (exact) domain values into a mapping (exact) domain values into a (graded) membership value.(graded) membership value.

talltall would be one fuzzy subset defined by such a would be one fuzzy subset defined by such a functionfunction which takes the which takes the heightheight (e.g. in inches) as (e.g. in inches) as input, and determines a fuzzy membership-value input, and determines a fuzzy membership-value (between 0 and 1) for (between 0 and 1) for talltall and and smallsmall as output. as output.

Page 41: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Fuzzy Set Membership Fuzzy Set Membership FunctionFunction

If Peter is If Peter is 6'6' high, and the fuzzy membership value high, and the fuzzy membership value of of talltall forfor 6'6' is is 0.90.9, then Peter is , then Peter is quitequite talltall..

Page 42: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Review Review Inexact ReasoningInexact Reasoning uncertain reasoninguncertain reasoning – uncertainty about facts – uncertainty about facts

and/or rules – and/or rules – CF TheoryCF Theory vaguenessvagueness – truth not 0 or 1 - – truth not 0 or 1 - Fuzzy sets and Fuzzy sets and

Fuzzy logicFuzzy logic beliefs, defaultsbeliefs, defaults – assumptions about truth, can – assumptions about truth, can

be revised – be revised – non-monotonic reasoning, Truth non-monotonic reasoning, Truth MaintenanceMaintenance SystemSystem

likelihood of eventlikelihood of event – statistical model of – statistical model of knowledge - knowledge - Probability TheoryProbability Theory

Page 43: Expert System Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Other Forms of Representing Other Forms of Representing and Reasoning with Inexact and Reasoning with Inexact

Knowledge Knowledge LogicsLogics

Explicit modeling of Belief- and Explicit modeling of Belief- and Knows-OperatorsKnows-Operators inin Modal LogicModal Logic or or Autoepistemic LogicAutoepistemic Logic..

Probabilistic ReasoningProbabilistic Reasoning Bayes’ TheoryBayes’ Theory Dempster-Shafer TheoryDempster-Shafer Theory