MYCIN ===== Introduction ------------ MYCIN is an expert system which recommends antimicrobial therapy in cases of bacteraemia (bacterial infections of the blood) and meningitis (infections of the membranes covering the brain). The "core" of the program is a backward chaining production system, consisting of about 450 rules. It interacts with the user by asking the user questions, and, if the user requests, providing explanations. It contains rules which make uncertain conclusions, and can accept uncertain answers from the user. The other parts of MYCIN (not considered here) provide an additional explanation capability, and allow a domain expert to add or modify rules without needing to understand the system. In order to use MYCIN, at least one organism must have been isolated from at least one culture taken from the patient. MYCIN uses a combination of clinical and laboratory data to determine the likeliest organisms, and suggests a regimen (a list of drugs + dosages). ---------- Design of MYCIN --------------- The part of MYCIN considered here identifies the organisms most likely to be causing the infection. The MYCIN knowledge base consists of three types of data structures: contexts, parameters and rules. Contexts are analogous to objects in an object-oriented system, or frames in a frame system, but their use in MYCIN is quite different. Parameters are analogous to slots in a frame system. There are several types of contexts, which form a tree structure during a consultation. At the base of the tree is the patient context (the root context). This contains data acquired about the patient, such as the patient's age and sex, whether the patient has been seriously burned, etc. Attached to the patient context is at least one culture context, which contains data about the culture, such as where it was taken from and the date and time of collection. Attached to each culture context is at least one organism context, which contains data about an organism isolated from the culture, such as its stain and morphology. Attached to each organism context are zero or more drug contexts, which correspond to drugs currently being used to combat the organism. A typical context tree is shown below: PATIENT-1 (PERSON) | +----------------+----------------+ | | | CULTURE-1 CULTURE-2 CULTURE-3 (CURCULS) (CURCULS) (PRIORCULS) | | | | | +-----+-----+ | | | | ORGANISM-1 ORGANISM-2 ORGANISM-3 ORGANISM-4 (CURORGS) (CURORGS) (PRIORORGS)(PRIORORGS) | | | | +-----+-----+ | | | | | | | | DRUG-1 DRUG-2 DRUG-3 DRUG-4 DRUG-5 (CURDRGS) (CURDRGS) (CURDRGS)(PRIORDRGS) (PRIORDRGS) Attached to each context type are goals, rules and parameters. The parameters attached to the context type are associated with data which refers to the context. The parameter shown below is attached to the patient context type. BURN ---- MEMBER-OF: PROP-PT VALUETYPE: BINARY EXPECT: (YN) PROMPT: (Is * a burn patient?) LABDATA: 1 LOOKAHEAD: (RULE047) TRANS: (* has been seriously burned) The acceptable values for BURN are Y(es) or N(o). PROMPT contains the question which would be asked when a value is sought -- the patient's name is substituted for *. TRANS is printed when a rule mentioning BURN is displayed. LOOKAHEAD contains rules which mention BURN in their condition. The rules associated with a context type are those which are useful in deducing a goal associated with a context of that type. They are backward chaining production rules. An example from the organism context type is: RULE047 ------- PREMISE: ($AND (SAME CNTXT SITE BLOOD) (NOTDEFINITE CNTXT IDENT) (SAME CNTXT STAIN GRAMNEG) (SAME CNTXT MORPH ROD) (SAME CNTXT BURN T) ACTION: (CONCLUDE CNTXT IDENT PSEUDOMONAS TALLY .4) CATEGORY: ORGRULES SELFREF: 1 In English, this is: IF: 1) the site of the culture is BLOOD, and 2) the identity of the organism is not known with certainty, and 3) the stain of the organism is GRAMNEG, and 4) the morphology of the organism is ROD, and 5) the patient has been seriously burned THEN: there is weakly suggestive evidence (.4) that the identity of the organism is PSEUDOMONAS SELFREF means that the rule is used recursively (the parameter whose value is concluded by the rule is mentioned in its condition). CATEGORY basically describes to which context the rule belongs. The syntax of the rules is such that the premise and action can be directly executed (by calling the LISP function EVAL), and inspected for use in explanations and by metarules. When MYCIN is consulted, values for the goals in the root context (patient) are deduced by the rules attached to the patient context type. If ever a rule needs the value of a parameter which can only be deduced using a rule attached to another context type, that context type is instantiated (creating a new context). Values for the goals of that context (take from its type) are then deduced. When all of the goals of a particular context have values deduced, the context is exited and its parent context is returned to. The consultation ends when the root context is exited. ---------- Certainty Factors ----------------- MYCIN uses certainty factors as an alternative to probabilistic reasoning. Certainty factors range from -1 (definitely false) through 0 (completely unknown) to +1 (definitely true). A certainty factor of zero coresponds to a probability which exists in the population at large (e.g. hospital patients). It does NOT mean a probability of 0.5. Certainty factors are intended to represent changes in prior probabilities as a result of evidence gathering rather than probabilities per se. Certainty factors are calculated as follows: (1) If a certainty factor already has a value x, it can be updated by a rule which concludes a value y according to the cfcombine function: cfcombine(x, y) = x + (1 - x) y if x and y are both positive, cfcombine(x, y) = - cfcombine(-x, -y) if x and y are both negative, cfcombine(x, y) = (x + y) / (1 - min(|x|, |y|)) if x and y have different signs. (2) The certainty factor of the condition of a rule is calculated as follows: cf(x ^ y) = minimum(cf(x), cf(y)) cf(x v y) = maximum(cf(x), cf(y)) cf(~ x) = -cf(x) (3) If a rule's premise has cf = x, and its action has cf = y, the CF concluded by the rule is xy. Rules are not pursued if they only make a small change to CFs. ---------- A Sample Consultation --------------------- (Taken from Rule Based Expert Systems (ed. Buchanan and Shortliffe), pp69-70) 1) Patient's Name: (first-last) ** FRED BRAUN 2) Sex: ** M 3) Age: ** 55 4) Are there any cultures for Fred Braun which may be related to the present illness, and from which organisms have been grown successfully in the microbiology laboratory? ** Y --------CULTURE-1-------- 5) From what site was the specimen for CULTURE-1 taken? ** BLOD = BLOOD <- System corrects typos. 6) Please give the date and time when CULTURE-1 was obtained. (mo/da/yr time) ** JUN 20, 1977 The first organism isolated from the blood culture of 20-JUN-77 (CULTURE-1) will be referred to as: --------ORGANISM-1-------- 7) Enter the laboratory-reported identity of ORGANISM-1: ** UNKNOWN 8) The stain (gram or Ziehl-Neelsen acid-fast) of ORGANISM-1: ** NEG 9) Is ORGANISM-1 rod or coccus (etc.): ** ROD 10) What is the form of the individual organisms (e.g. lancet- shaped for cocci, fusiform for rods, etc.)? ** FUSIFORM (*** missing questions ***) 23) What is the suspected portal of entry of the gramneg rod from the blood culture of 20-JUN-77 (ORGANISM-1) into this sterile site? ** GI (6) <- User is uncertain. 24) Is Fred Braun a burn patient? ** N 25) Is Fred Braun a Compromised host (e.g. alcoholic, sickle-cell disease, immunosuppressed)? ** N 26) Is Fred Braun febrile? ** Y (*** missing questions ***) My therapy recommendations will be designed to treat for organisms that are either very likely or, although less likely, would have a significant effect on therapy selection if they were present. It is important to cover for the following probable infection(s) and associated organism(s): INFECTION-1 is BACTEREMIA E.COLI [ORGANISM-1] KLEBSIELLA [ORGANISM-1] ENTEROBACTER [ORGANISM-1] KLEBSIELLA-PNEUMONIAE [ORGANISM-1] (*** missing questions ***) [REC-1] My preferred therapy recommendation is as follows: In order to cover for items <1 2 3 4>: Give: GENTAMICIN Dose: 119 mg (6.0 ml) q8h IV for 10 days [calculated on the basis of 1.7 mg/kg] Comments: Modify dose in renal failure. ---------- Explanation ----------- This shows how MYCIN justifies its reasoning DURING a consultation; further explanation is offered once a consultation is completed. 15) Is the patient's illness with ORGANISM-1 a hospital-acquired infection? ** WHY [i.e. WHY is it important to determine whether or not the infection with ORGANISM-1 was acquired while the patient was hospitalized?]] [1.0] This will aid in determining the category of ORGANISM-1. It has already been established that [1.1] the gram stain of ORGANISM-1 is gramneg, and [1.2] the morphology of ORGANISM-1 is rod, and [1.3] the aerobicity of ORGANISM-1 is facultative Therefore, if [1.4] the infection with ORGANISM-1 was mot acquired while the patient was hospitalized then there is strongly suggestive evidence (.8) that the category of ORGANISM-1 is enterobacteriaceae ALSO: there is weakly suggestive evidence that the identity of ORGANISM-1 is pseudomonas-aeruginosa [RULE037] ** HOW 1.3 [i.e. HOW was it established that the aerobicity of ORGANISM-1 is facultative?] The following rules were used: [3.1] RULE027 indicated there is strongly suggestive evidence (.8) that the aerobicity of ORGANISM-1 is facultative [3.1] RULE027 indicated there is weakly suggestive evidence (.2) that the aerobicity of ORGANISM-1 is anaerobic Since this gave a cumulative CF of (.8) for facultative, and (.2) for anaerobic, it has been established that the aerobicity of ORGANISM-1 is facultative ----------