Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert...

16
Decision Support via Expert Systems 6.872/HST950 Peter Szolovits Components of an Expert System • Knowledge – In various forms: associations, models, etc. • Strategy – Baconian, exhaustive enumeration, on-line, etc. • Implementation – Programs, pattern matching, rules, etc. Flowchart BI/Lincoln Labs Clinical Protocols 1978 Codifying Human Knowledge Decomposition into “chunks” of knowledge, chaining of inferences Matching of case data to prototypical situations Using causal models (pathophysiology) to figure out cases

Transcript of Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert...

Page 1: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

Decision Supportvia Expert Systems

6.872/HST950 Peter Szolovits

Components of an Expert System

• Knowledge – In various forms: associations, models, etc.

• Strategy – Baconian, exhaustive enumeration, on-line,

etc. • Implementation

– Programs, pattern matching, rules, etc.

Flowchart

BI/Lincoln Labs Clinical Protocols 1978

Codifying Human Knowledge

• Decomposition into “chunks” of knowledge, chaining of inferences

• Matching of case data to prototypical situations

• Using causal models (pathophysiology) to figure out cases

Page 2: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

Mycin—Rule-based Systems

• Task: Diagnosis and prescription for bacterial infections of the blood (and later meningitis)

• Method: – Collection of modular

rules– Backward chaining– Certainty factors

RULE037

IF the organism1) stains grampos2) has coccus

shape3) grows in chains

THENThere is suggestive evidence (.7) that the identity of the organism is streptococcus.

Mycin consult--------PATIENT-1--------1) Patient's name: FRED SMITH2) Sex: MALE3) Age: 554) Have you been able to obtain positive cultures from a site at which Fred

Smith has an infection? YES--------INFECTION-1--------

5) What is the infection? PRIMARY-BACTEREMIA6) Please give the date when signs of INFECTION-1 appeared. 5/5/75The most recent positive culture associated with the primary-

bacteremia will be referred to as:--------CULTURE-1--------7) From what site was the specimen for CULTURE-1 taken? BLOOD8) Please give the date when this culture was obtained. 5/9/75The first significant organism from this blood culture will be called:

--------ORGANISM-1--------9) Enter the identity of ORGANISM-1. UNKNOWN10) Is ORGANISM-1 a rod or coccus (etc.)? ROD11) The gram stain of ORGANISM-1: GRAMNEG. . .

Davis, et al., Artificial Intelligence 8: 15-45 (1977)

How Mycin Works• To find out a fact

– If there are rules that can conclude it, try them – Ask the user

• To “run” a rule – Try to find out if the facts in the premises are true – If they all are, then assert the conclusion(s), with a suitable certainty

• Backward chaining from goal to given facts

© Dynamically traces out behavior of (what might be) a flowchart © Information used everywhere

appropriate © Single expression of any piece of

knowledge

Explore Mycin’s Use of Knowledge

** Did you use RULE 163 to find out anything about ORGANISM-1?

RULE163 was tried in the context of ORGANISM-1, but it failed because it is not true that the patient has had a genito-urinary tract manipulative procedure (clause 3).

** Why didn't you consider streptococcus as a possibility?The following rule could have been used to determine that the identity

of ORGANISM-1 was streptococcus: RULE033But clause 2 (“the morphology of the organism is coccus”) was already

known to be false for ORGANISM-1, so the rule was never tried.Davis, et al., Artificial Intelligence 8: 15-45 (1977)

Page 3: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

Even Simpler Representation

Disease

s1s2s3s4s5s6s7s8s9s10s...

Disease

s1s2s3s4s5s6s7s8s9s10s...

Diagnosis by Card Selection

Disease

s1s2s3s4s5s6s7s8s9s10s...

Disease

s1s2s3s4s5s6s7s8s9s10s...

Disease

s1s2s3s4s5s6s7s8s9s10s...

Disease

s1s2s3s4s5s6s7s8s9s10s...

Diagnosis by Edge-Punched Cards

ØDx is intersection of sets of diseases that may cause all the observed symptoms

ØDifficulties: ØUncertainty ØMultiple diseases

~ “Problem-Knowledge Coupler” of Weed

Taking the Present Illness—Diagnosis by Pattern Directed Matching

Page 4: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

Matching as Basis for Reasoning

13

Pauker, S. G., Gorry, G. A., Kassirer, J. P., & Schwartz, W. B. (1976). Towards the simulation of clinical cognition. Taking a present illness by computer. The American Journal of Medicine, 60(7), 981–996.

PIP's Theory of Diagnosis• From initial complaints, guess suitable hypothesis.• Use current active hypotheses to guide questioning• Failure to satisfy expectations is the strongest clue

to a better hypothesis; differential diagnosis• Hypotheses are activated, de-activated, confirmed or

rejected based on (1) logical criteria (2) probabilities based on:

findings local to hypothesiscausal relations to other hypotheses

The Scientific Method

Present Illness Program (PIP) Model of Memory

15

Active Pattern Matching in PIP

16

Page 5: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

Memory Structure in PIP

Hypothesis

Logical Criteria

ProbabilisticScoringFunction

DifferentialDiagnosisHeuristics

Triggers

Causally andAssociationallyRelated Hyp's

Manifestations

PIP's Model of Nephrotic SyndromeNEPHROTIC SYNDROME, a clinical stateFINDINGS:

1* Low serum albumin concentration2. Heavy proteinuria3* >5 gm/day proteinuria4* Massive symmetrical edema5* Facial or peri-orbital symmetric edema6. High serum cholesterol7. Urine lipids present

IS-SUFFICIENT: Massive pedal edema & >5 gm/day proteinuriaMUST-NOT-HAVE: Proteinuria absentSCORING . . .MAY-BE-CAUSED-BY: AGN, CGN, nephrotoxic drugs, insect bite,

idiopathic nephrotic syndrome, lupus, diabetes mellitusMAY-BE-COMPLICATED-BY: hypovolemia, cellulitisMAY-BE-CAUSE-OF: sodium retentionDIFFERENTIAL DIAGNOSIS:

neck veins elevated ➠ constrictive pericarditisascites present ➠ cirrhosispulmonary emboli present ➠ renal vein thrombosis

QMR Partitioning

M1

M2

M3

M4

M5

M6

H1 H2

Competitors

M1

M2

M3

M4

M5

M6

H1 H2

Page 6: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

Still Competitors

M1

M2

M3

M4

M5

M6

H1 H2

Probably Complementary

M1

M2

M3

M4

M5

M6

H1 H2

Multi-Hypothesis Diagnosis

ØSet aside complementary hypotheses Ø… and manifestations predicted by them ØSolve diagnostic problem among

competitors ØEliminate confirmed hypotheses and

manifestations explained by them ØRepeat as long as there are coherent

problems among the remaining data

Internist/QMRØKnowledge Base:

Ø956 hypotheses Ø4090 manifestations (about 75/hypothesis) ØEvocation like P(H|M) ØFrequency like P(M|H) Ø Importance of each M ØCausal relations between H’s

ØDiagnostic Strategy: ØScoring function ØPartitioning ØSeveral questioning strategies

Page 7: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

QMR Database QMR Scoring

ØPositive Factors ØEvoking strength of observed Manifestations ØScaled Frequency of causal links from

confirmed Hypotheses ØNegative Factors

ØFrequency of predicted but absent Manifestations

ØImportance of unexplained Manifestations ØVarious scaling parameters (roughly

exponential)

Example Case Initial Solution

Page 8: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

Pople’s Caduceus (proposed successor to Internist) X

X<

<■3c

■om

z"

Os

oSo

OBq

2z

r-Z

r ^

r =

ic

CO

p09

>25

t*zS

go>

>

X 2™o

2>X

ML

opo r m v> >

o9

(0*i>

v>X

Causal Network has disease states and findings

Diseases may be organized by organ system or etiology (cause)

EXTRA-HEPATICBILE OUCT

INVOLVEMENT

INTRAHEPATICBILE OUCT

INVOLVEMENT

FIBROTICHEPATOCELLULAR

INVOLVEMENT

INFLAMMATORYHEPATOCELLULAR

INVOLVEMENT

PERICHOLANGITIS KICRONOOAL

(A)

(B)

Note: heterarchy

Diseases may be organized by organ system or etiology (cause)

EXTRA-HEPATICBILE OUCT

INVOLVEMENT

INTRAHEPATICBILE OUCT

INVOLVEMENT

FIBROTICHEPATOCELLULAR

INVOLVEMENT

INFLAMMATORYHEPATOCELLULAR

INVOLVEMENT

PERICHOLANGITIS KICRONOOAL

(A)

(B)

Page 9: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

“Planning Links” abstract over ambiguous causal relations

jm Q m

LJ

flt▼

z uO

Z 3

CO

"0o

UBCLASSIFICATI

ANIFESTATION/

OSOLOGIC DES

ISEASE STATE

r- > z z z o r z

55 m O H O > c 0) m o ■O

-2

O

CD3

) Z

Z-<

^ 2

1-3

zz

3o

*

c_ >"O

c>

zt-

oO

o3J

m

Diagnostic Tasks

• Determine which sub-categories or individual diseases in a nosology is the correct classification

• Determine which disease or disease category is the most appropriate cause of a symptom

• Insight: Possible to combine/interleave both tasks

Explaining Caput Medusae involves both finding subtype of portal hypertension and its cause Synthesis Operators

a) Descriptors P and Q might define sub-classification tasks that are related via some nosological structure; e.g.:O1) P might be a sub-classifier of Q, in which case we say that P is a specialization of Q. In this case, the result of applying the intersection operator to P and Q is just the descriptor P. O2) If neither P nor Q is a specialization of the other, but their differential diagnosis lists have sub-nodes in common(24) then the result of intersection is just the list of common sub- nodes. b) Descriptors P and Q might define causal tasks that are related via the pathophysiological network structure; e.g.: O3) P might describe a state that is a cause of Q. As in O1 above, the result of applying the intersection operator to these two descriptors would he just the descriptor P. O4) P and Q might not be causally related to one another, but have common causes among elements of their differential diagnosis lists. The synthesized differential diagnosis list would contain all and only these common elements. c) Descriptors P and Q might be related through some combination of causal and subclassification tasks; e.g.,O5) P might be causally linked to one or more sub-classifier nodes of Q. The resulting synthesized differential diagnostic task would be to decide among the selected sub-classifiers of Q. There would also be a reduced causal task associated with P.O6) P and Q or their sub-classifiers might be causally related to identical nodes, or to nodes that are specializations of one another in some nosology. The causal tasks associated with P and Q resulting from application of the intersection operator would be the most specialized set of common causes. 

Page 10: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

Operators Formulate a Search Space

• Diagnosis is a search through the space of all hypotheses reachable by applying operators to the initial formulation

• Vast space, hence greedy search• Driven by some measure of merit, similar to Internist’s scoring:

• How well important symptoms are explained• How likely are combinations of causes• How specific are hypotheses• “Okham’s Razor”• details were not well worked out

Exploring the Search Space

— Tom Wu, Ph.D. 1991

Assume a bipartite graph representation of diseases/symptoms

Given a set of symptoms, how to proceed?

If we could “guess” an appropriate clustering of the symptoms so that each cluster has a single cause …

… then the solution is (d5, d6) x (d3, d7, d8, d9) x (d1, d2, d4)

Symptom Clustering forMulti-Disorder Diagnosis Clustering Alternatives

Symptom Possible Causes

Fever TB, Hepatitis, Malaria

Cough TB, Asthma, Bronchitis, Emphysema

TB

Hep

Mal

Asth

Bron

Emph

TB

Hep

Mal

Asth

Bron

Emph

Fever, Cough

TB

Fever Cough

Hep Mal

Asth Bron Emph

H1 H2

Page 11: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

Synopsis in Renal Disease• Diseases

– Hypertension (HTN) – Acute glomerulonephritis (AGN) – IgA nephropathy (IgA) – Prerenal azotemia (PRA) – Hepatorenal syndrome (HRS) – Renal vasculitis (RV) – Congestive heart failure (CHF) – Aldosteronism (Aldo) – Constrictive pericarditis (Peri) – Diabetic ketoacidosis (DKA) – Analgesic nephropathy (AN) – Hypokalemic nephropathy (HKN) – Chronic renal failure (CRF)

• Symptoms – High urine osmolality (Osm↑) – High urine specific gravity (Sg↑) – Low urine sodium (Na↓) – Low urine pH (pH↓)

HTN AGN IgA PRA HRS RV CHF Aldo Peri DKA AN HKN CRF RTAOsm↑

X X X X X X

Sg↑ X X X X X X X

Na↓ X X X X XpH↓ X X X X X X X

After Osm↑Osm↑

HTN AGN IgA PRA HRS RV

HTN AGN IgA PRA HRS RV CHF Aldo Peri DKA AN HKN CRF RTAOsm↑

X X X X X X

Sg↑ X X X X X X X

Na↓ X X X X XpH↓ X X X X X X X

Add Sg↑Osm↑, Sg↑

HTN AGN IgA

PRA HRS RV

HTN AGN IgA PRA HRS RV CHF Aldo Peri DKA AN HKN CRF RTAOsm↑

X X X X X X

Sg↑ X X X X X X XNa↓ X X X X X

pH↓ X X X X X X X

Cover

Add Na↓

Osm↑, Sg↑, Na↓PRA HRS

Osm↑, Sg↑

HTN AGN IgA RV

Na↓

Aldo CHF Peri

HTN AGN IgA PRA HRS RV CHF Aldo Peri DKA AN HKN CRF RTAOsm↑

X X X X X X

Sg↑ X X X X X X XNa↓ X X X X X

pH↓ X X X X X X X

or

Restrict Append

Page 12: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

Search Space(Osm↑)

(Osm↑, Sg↑)

(Osm↑, Sg↑, Na↓) (Osm↑, Sg↑) (Na↓)

(Osm↑, Sg↑, Na↓, pH↓) (Na↓) (Osm↑, Sg↑, pH↓)

(Osm↑, Sg↑, Na↓) (pH↓) (Osm↑, Sg↑) (Na↓) (pH↓)

C

R A

REA

R

A

C=cover

R=restrict

A=append

E=extract

HTN AGN IgA PRA HRS RV CHF Aldo Peri DKA AN HKN CRF RTA

Osm↑

X X X X X XSg↑ X X X X X X X

Na↓ X X X X X

pH↓ X X X X X X X

• Like in any “planning island” approach, reducing an exponential problem to several smaller exponential problems vastly improves efficiency, if it captures some insight into the problem.

• Wu's algorithm (SYNOPSIS) will keep a compact encoding even if it overgenerates slightly.

• E.g., suppose that of the set of diseases represented by (d5, d6) x (d3, d7, d8, d9) x (d1, d2, d4), d6 x d8 x d1 is not a candidate. To represent this precisely would require enumerating the 23 valid candidates. Instead, the factored representation is kept.

In a diagnostic problem drawn from a small subset of the Internist database, it is a power of 3 faster and a power of 5 more compact than standard symptom clustering.

Guide search via probabilities, if we have a reasonable model(!)

Symptom Clustering is Efficient

More Expert Systems

• Causality? • What’s in a Link? • Temporal reasoning • Quantitative reasoning • Model-based reasoning • Workflow

Meaning of Representation?

• Always? àprobability • Magnitude? àseverity; bad cold à worse fever? • Delay? àtemporality • Where? àspatial dependency • Under what conditions? àcontext • Interaction of multiple causes àphysical laws • Cross-terms àhigh-dimensional descriptions

SDcauses

Page 13: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

ØKeeping track of multiple forms of temporal relations (Kahn '75)ØThe time line

Ø“On Dec. 12 last year . . .”ØSpecial reference events

Ø“Three days after I was hospitalized in 1965 . . .”ØTemporal Ordering Chains

Ø“It must have been before I graduated from high school.”

ØConstraint propagation (Kohane '87)ØPrimitive relation: e1, e2, lower, upper boundsØHeuristics for propagation based on semantic grouping

3, 52, 7

l, u

Temporal Reasoning

E1 E3

E23 ≤ T(E2)-T(E1) ≤ 5 2 ≤ T(E3)-T(E2) ≤ 7 Therefore l=5 ≤ T(E3)-T(E1) ≤ 12=u

bloodtransfusion

abdominalpain

jaundice

?

?

Exploiting Temporal Relations

Ø transfusion precedes both abdominal pain and jaundice implies transfusion-borne acute hepatitis B

Ø as in 1, but only by one day Ø jaundice occurred 20 years ago, transfusion and pain

recent Ø Can be very efficient at filtering out nonsense

hypotheses.

Interpreting the Pastwith a Causal/Temporal Model

Postdiction

Long, Reasoning about State from Causation and Time in a Medical Domain, AAAI 83

Page 14: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

Temporal Representation can be Complex

Signal-to-symbol problem E.g., Zeeshan Syed’s PhD: 1. Time-align signals via dynamic time

warping 2. Cluster patterns 3. Assign symbolic name to each

cluster

TimeThe usual:

• point, intervals, constraints

• timelines, reference events, fuzz, … The unusual

• cyclic edema • focal glomerulonephritis • patterns of fever

Systems issues • flow of "now" • supporting the illusion of "instantaneous" decision-making within

a temporal reasoner – correcting the past – reasoning by hindsight

e1 e2

min ≤ duration ≤ maxe1

e2e3

The Surprisingly Normal pH

ØDiarrhea causes bicarbonate (alkali) loss ØVomiting causes acid loss ØTherefore, normal pH is a manifestation of

{diarrhea + vomiting}!

Multi-Level Causal Model

Page 15: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

Reasoning from Models

ØModel handles all possible interactions, without having explicitly to anticipate them all

ØReasoning: Fit parameters to a physiological model, then predict consequences to suggest Øother expected findings Ø reasonable interventions

ØQualitative models ØCombining associational and model-based

reasoning

Guyton's Model of Cardiovascular Dynamics

Heart Disease Model

EXERCISE

VENOUSVOLUME

VENOUSCONSTR

RESISTVENOUS

RET

RAP

RVEDP

RVOUTPUT

RVCOMPL

RVEMPTYING

RVSYSTOLICFUNCT

BLOODVOLUME

RENALPERF

SVR

BLOODPRESS

SYSTOLPRESS

CO

LVOUTPUT

LVEDP

LAP

MITRALSTENOSIS

LVSYSTOLICFUNCT

LVCOMPL

LVEMPTYING

PULMVOL

PAPRESS

PULMVASCULRESIST

MYOO2

CONSUMP

MYOISCHEMIA

MYOPERF

WALLTENSION

INOTROP

HEARTRATE

DIASTIME

SYSTTIME

VAGALSTIM

SYMPSTIM

venous circulation systemic circulation

therapy

right heartpulmonary circulation

left heart

ischemia

autonomic regulation

diseases

Long's Clinical Model of Heart FailurePredictions for Mitral Stenosis with Exercise

Page 16: Components of an Expert System - MIT CSAILpeople.csail.mit.edu/Psz/6.872/N/Decision Support-Expert Systems.key.pdfMycin—Rule-based Systems • Task: Diagnosis and prescription for

Physiological "All variations in myocardial contractile activity can be expressed as displacements of the force-velocity curve. However, there are two fundamental ways in which the force-velocity curve can be shifted. Figure {left} shows a family of force-velocity curves obtained from an isolated cardiac muscle; each curve was obtained at a different preload, i.e., with a different degree of stretch on the muscle. Note that changing the preload has altered the intercept of the force-velocity curve on the horizontal axis; i.e., it has increased the isometric force developed by the muscle. However, these alterations in preload have not altered the intrinsic velocity of shortening, since all the curves extrapolate to the same intercept on the vertical axis. Thus, a change in initial length of heart muscle shifts the force-velocity curve by altering the total force which can be developed by the muscle. This type of shift in the force-velocity curve may be contrasted with that obtained when a positive inotropic agent, such as norepinephrine or digitalis, is added to the muscle while the initial length is held constant (Fig. {right}). These agents not only increase the force which the muscle is capable of lifting, i.e., the intercept of the force-veolocity curve on the horizontal axis, but also increase the velocity of shortening of the unloaded muscle, i.e., the extrapolated intercept on the vertical axis."

— Harrison's (6th ed.)

Figures

Normal cat-muscle Inotropic Agent

Clinical Knowledge

"… from the clinical point of view, heart failure may be considered to be a disease state in which an abnormality of myocardial function is responsible for the inability of the heart to pump blood at a rate commensurate with the requirements of the metabolizing tissues. Though a defect in myocardial contraction always exists in heart failure, this disorder may result from a primary abnormality in the heart muscle or it may be secondary to a chronic excessive work load. It is important to distinguish heart failure from (1) states of circulatory insufficiency in which myocardial function is not primarily impaired, such as cardiac tamponade, hemorrhagic shock, or tricuspid stenosis, (2) conditions in which there is circulatory congestion because of abnormal salt and water retention but in which there is no serious disturbance of myocardial function, and (3) conditions in which the normal heart is suddenly presented with a load which exceeds its capacity, e.g., accelerated hypertension."