An Expert System Interpreter for Time Course Data with Refinement in Context From: AAAI Technical Report SS-94-01. Compilation copyright © 1994, AAAI (www.aaai.org). All rights reserved. P. Preston, P. Compton,D. Litkouhi Schoolof ComputerScience and Engineering, University of NewSouth Wales Sydney2033 Australia (pkilp@cse.unsw.edu.au,compton@cse.unsw.edu.au, dar@cse.unsw.edu.au) G. Edwards Departmentof ChemicalPathology,St Vincent’sHospital Sydney2010Australia (glenn@cse.unsw.edu.au) Introduction Knowledge acquisition and knowledgemaintenanceare problemswith any expert system. Theseproblemsare exacerbatedin domainsdealing with temporaldata such as the exampledata sets distributed for AIM-94. Knowledgeacquisition for such domains requires informationabouthowfeatures In the data are identified as well as howthese features are reasoned about. Ripple DownRules (RDR)Is a knowledgeacquisition methodologywhich goes somewaytowards addressing these problems. The problem with knowledge acquisition and maintenanceis that the knowledgean expert provides, whetheraboutfeature Identification or reasoningabout features, cannot be guaranteedto apply outside the context in which it was provided by the expert [Compton,1990]. The RDRapproach attempts to use the knowledge only In the samecontext in whichit was provided. For rule based systems a new rule (a correction) ts attached at the end of the sequenceof rules which had been evaluated giving the wrong conclusion.This rule is evaluatedonly after the same rules are evaluated with the same outcomes as previously. Rulesare never removedor corrected, only added. All rules providea conclusion, but the final output of the systemcomesfromthe last rule that was satisfied by the data. The case that promptedthe addition of the rule Is also stored to validate further knowledge acquisition. Onlyvalid rules are allowed.Avalid rule is one that will correctly interpret the newcase for whichit is addedbut will not be satisfied by the case associated with the previouslast true rule in the sequenceof rules evaluated. The expert Is required to choose rule conditions from a list of differences between the currentcaseandthe caseattachedto the last true rule to ensurea valid rule. It might be expectedwith the RDRapproachthat rule contexts would be too specific resulting in much repetition and redundancyin the knowledge base. This does not occur [Mansurl, 1991; Gaines, 1992] presumablybecausethe approachallows the expert to focus on domain Issues rather than knowledge engineering.Amajorvalidation of the approachis the PEIRSsystemin routine use tn the Dept. of Chemical 115 Pathology, St.Vincent’s Hospital Sydney[Compton, 1992, Edwards1993]. PEIRSnowhas morethan 2000 rules. It covers about 25%of ChemicalPathologyand is over 95%accurate. Thesystemwasput into routine use after 200 rules were added. All other rules have been added by experts as errors occur, without knowledge engIneeringassistance. It takes about three minutesto adda newrule andthe laboratoryanticipates continuouson goingdevelopment as it is trivial to add to the systemas domainknowledgeevolves. Thedata used by PEIRSis characterised by multiple test results on sequential specimenssubmittedto the diagnostic laboratory. The major knowledge engineering effort with PEIRSwas deciding what functions had to be applied to the data and what features had to be extracted. Nine fairly simple functions such as MIN, MAX,and AVERAGE. Transformations of data allow abstractions such CURR(BLOOD_C02) is HIGHto be used in rules. Thesefeatures and functions are hard coded. This very simple approach only works because the features identified can be refined in context. That is, a rule sequence may include TSHis HIGHand TSH<10. Simplemathematicalexpressions can also be included in context [Srinivasan 1991]. Thesenewfeatures and functions are not namedand so cannotbe used in other contexts, but they allowthe systemto deal with fairly complextime course data with very simple predefined features andfunctions. Thediabetes data in AIM-94 data is likely to require other features and functions which are even more difficult for the expert to pre-identifythan with PEIRS. A newimplementation of RDRhas been developed to address this problem. TCRDR (Time Course Ripple Down Rules) uses a moreflexible interpreter, allowing for the creation of reusabledata abstractions. Aswell, the user interface has been de-coupled from the Inferenceengine, allowingfor greater portability - the inference engine does not need to be on the same machineas the interface. It also allows for easy eustomisationof the interface, as wellas testing of the interface and inferenceengine. In TCRDR, internal data is essentially stored in a 2 dimensionalarray, very like the appearanceof the raw data. Withthis representationit is possible to directly address individual elementsof the array. It is also possible to reference data points temporally, as in referencingthe valueof a test at sometimein the past. A set of operators is supported that allows combinationsof data references to be combinedinto a functionor feature. Thesefirst order abstractions can also be combinedto form higher level features and functions, leading to arbitrarily complexfeatures. New features and functions can be addedat any time in the systems development.Howeverthe central feature of the RDRapproachremainsin whichrules are addedin context allowingfeatures to be refined in context. As with PEIRS,this allows simpleand inadequatefeatures and functions in context as required. Theburden of trying to achieve perfect feature identification is removed by allowing local fixes to inadequate definitions. definitions as requiredandadd rules. This is a slightly moredifficult task than just addingrules as the expert had to understand the function interpreter syntax. However, no knowledge engineering knowledge is required becausethe RDRapproachavoids the problem of havingto understandpotential interactions between rules. Someknowledgeengineering/programmingassistance is still required in setting up and appropriate data representation. Themain environmentdevelopedfor the expert in workingwith the data can be seen in Fig 1. Theexpert wasinterested in reviewingthe data in the form of sliding windowsat different times. Data typically werenot dense, so that a window widthof 11 wouldprovide several days data at once. Internally provision wasmadefor workingwith windowsof some 40 columnsmaximum. It mayseema restriction but as it is a sliding window, data can be reviewedfor periods in the past at anytime. Aim Theaim of the present study wasto build a systemto deal with the AIM-94 diabetes data in whichthe expert was expected to add his ownfunction and feature RDR Shell/AIM Figure1 HI~ W gls,~oll. Inb=14~l tcmlght’S I,umlln ! O =I ](PlUI~II0,1O0) ~. iiGet Windowl i" I(w’~. t LestTruelIs ILesl RuleI 9~II mg~mol II moDmg Ilnun eutollSu I IITi .....~.ao12.~m.oon.oou.oot2.aai..oon.~ ~.oom.oo Imrll .... 0.00 io i lU~.g,,.;~ .... ~p~t-onm 0.17 4 0.42 O.SI 1.00 io 141 10 I.I? 4 ............................................ II 1.42 I0 I,M 2.~ 14 ~I 2.~ ~ 10 r"li ~n IEI IF’" ................"............"........ |1 ::::::::’":::::::::::::::: mn |1 ............................................ |1 H i gi~d |! ............................................ The main knowledge acquisition screen. The experthas facilities hereto review windowsof data, depending on how temporallythe rules he Is requiredto make,test data, call up screens for making new rules or reviewing existing rules or conclusions. II............................................ |1 T~lp.[xi; ¯ Li~..F.ml I~ ~,~nt ...o IleO-s~ .... ¯ leO.~ .... I o ...... . . .... o ...... ............................................ ............................................ o.z? o.,~ Ill.rl 3.50 9.49 1.2"/ 6.44 Ill.r/ 1.110 ll.il4 . ................... 1.21 6.~I "/.22 12.21 ?.~13 ,I.61 S.:N 9.99 6.94 10.06 Systemaim Thediabetes data wasused to build rules designedto assist patients monitortheir insulin therapy for the followingreasons[Hauser,Kraegenet el. 1992] i) most patients monitoringtheir ownglucose levels are highly motivatedand generally awareof the purposeof monitoring. ii) patients, In concertwiththeir physicians,develop a goodsense of their individual responses to insulin therapy and to environmental factors which impact upon glucose levels and insulin requirements. nltl I~I ~;),lI iv) v) g for the support of family or communitycaters whomaybe required to supervise monitoringbut have less sophisticated knowledge of the principles of monitoring; to assist clinicians and diabetes specialists in periodicassessmentsof patients’ cumulativedata. Wedo not believe these systemsshould replace or in any way subsumethe patient’s role in monitoring his/her diabetes. Thefollowingtypes of output wereseen as potentially useful and wereincorporatedinto interpretations generated by the RDRtool built for the AIM’94 dataset: Themostappropriateuse of AItechniquesis then: as a "back-up" system to alert patients to t) indicationof undesirablyhigh or lowresults; i) importantdata that mayrequire intervention; ii) recommendations for the nature of intervention; ii) to critique the appropriatenessof interventions; iii) recommendations for the timing of intervention. lii) as an educational tool for patients entering a monitoringprogram; 116 Wedid not attempt to model individual’s responses to insulin therapy or provide quantitative estimates of adjustmentsto insulin therapy. The following are simple examples of refinement. In clinical practice, a number of factors may significantly alter our approach to managementof diabetes. These include the patients age, presence of co-existing Illness, other drug therapy and general level of competencein self-monitoring. The absence of this data forces us to assume all patients are "average" patients - a tenuous concept which constrains our systems’ ability to fine-tune its recommendations. Preg-BG > 180 => High fasting glucose. Considerincreasing night-time Insulin. Thus, the following clinical principles were incorporated into rules: i) aim to maintain glucose levels between 80 - 180 mg/dL; ii) modifications to Insulin dosage were suggested if sustained high (or low) levels were obtained over 2-3 days. To this end, functions for calculating 2day and 3-day meanswere written. iii) more Immediate intervention was recommended for more extreme high or low values (< 60 or 280 mg/dL) Results The expert added a numberof functions to the system, including: CURR(x) :x[0] PREVI(x)¯ x[-1] PREV2(x): x[-21 most recent value of a test 2rid most recent value 3rd most recent : prev2[x] %prevl(x) %curt(x) IMIN(x) MAX(x): prev2[x] $ prevl(x) $ cuff(x) (% = minimumoperator; $ = maximumoperator) In the context of AIM-94diabetes, the definitions of MAXand MINwould allow for finding the MAXor M/NBGmeasurementsfor a particular period - such as the maximumpre-breakfast BG Other definitions Include last_two_average(x): (CURR(x) + PREVI(x))/3) last_three_average(x) (CURR(x) + PREVI(x) + PREV2(x))/3) I which simply averages the last measurementsfor a reading. three available At the time of writing, the experthad added 63 ripple downrules whichused the functions above to deal with the AIMdata set. Further rules are being added, and additional functions maybe required. The key element in this approachis that the very simple global functions above can be refined in context with the RDR.At this stage the expert does not have to consider the global utility of the refinements as they only apply to the context, the particular chain of rules. 117 This rule was entered I It was then discovered that it didn’t apply in the following circvmstances Prevl (preb_BG) <180 => High fasting glucose. Yesterday’s level OK. Suggest: let’s see fasting level tomorrowbefore changing anything. I Another Independent refinement was also added Prevl(preb_BG) >180 and Prev2(preb_BG) < 180 => High fasting glucose over consecutive days. Try increasing night-time insulin dose tonight. I In the tree built so far, the longest chain of corrections before reaching a final conclusion was five. Discussion With PEIRS, we showed that the RDRapproach to knowledge acquisition provides a framework for medical experts to build expert systems for interpreting complexdata sets IF_Awardset al 1993]. For the AIM’94diabetes data set our expert used TCRDR to identify features in the data and create his ownfunctions for use in rules. The flexibility of this approach further enhances the freedom conferred to domain experts by RDR, allowing them to build useful expert systemsin the real world. The PEIRSresults show that the RDRapproach can be used with fairly short time course data (five time points). The results here demonstratethat this can be extended to more complex time course data. With more complex time course data it becomes more difficult to predeterminethe type of data abstraction required so the TCRDR system used here allowed the expert to construct his own function and feature definitions. Theexpert building the expert system for the diabetes data worked on his own with minimal consultation with the knowledge engineer who originally packaged the data for him. Most of the consultation that did take place was in providing the data in the form the expert wanted, rather than encoding the experts knowledge. As well, the Interface system used for the Inference engine (a HyperCardstack in communication with a separate Inference engine C program) proved to be a viable method of communication with the expert. Changes to the interface were easily madeon the spot as required. Tasmania, WorldScientific, Singapore 1992, pp. 349354 The crucial features of this developmentare that any inadequacies in the global functions and features decided by the expert can be refined in context. Secondly the expert does not need knowledge engineering assistance or skill to add rules or functions in the developing system. Thirdly the system allows trivial maintenance and on-going developmentwhile in use. This allows the system to evolve as more knowledge is accumulated about the domainand clinical practice evolve. 4. Mansuri,Y., Compton, P., and Sammut,C.: A comparison of a manual knowledge acquisition method and an inductive learning method. In: J. Boose, J. Debenham, B. Gaines and J. Quinlan (eds.):Australian workshopon knowledgeacquisition for knowledge based systems. Pokolbin, 1991, pp. 114-132 5. Srinivasan, A., University of NSW& St Vincents Hospital, Sydney, An expert system for interpreting chemical pathology data, 1991, Internal Report In a conventional system changing feature definition rules causes major problemsbecause it is very hard to understand rule interactions (Grossner, Preece et al. 1993). The TCRDR system solves this problem by allowing refinement in context. However the situation mayarise with a particularly poor definition that the same refinement is being used In many contexts. This can be solved by a new definition, howeverthe expert mayprefer to change the original definition, in which case all the conventional problems emerge. Westress that this problem has not yet emerged,but it ts possible. To solve this problem we have a system under development whereby changes in definitions are only used by rules added after the definition has been changed(Menzies1992). As with RDR,definition changes are validated by taking into accountcase differences. 6. Edwards,G., Compton,P., Malor, R., Srinivasan, A. and Lazarus, L. (1993). "PEIRS: a pathologist maintained expert system for the interpretation of chemical pathology reports." Pathology : 25:27-34. 7. Clancey, W. (1993). Situated Action: Neuropsychological Interpretation Response to Vera and Simon. Cognitive Science 17(1): 87-116. 8. Compton, P., Kang, B., Preston, P. and Mulholland, M. (1993). Knowledge Acquisition without Analysis, in N. Aussenac, G. Boy, B. Gaineset al (Eds.), Knowledge Acquisition for Knowledee Based Systems. Lecture Notes in AI (723). Berlin, Springe-r Verlag. 278-299. Finally, this primitive approach of patching errors seemsinelegant in contrast to the search for elegant abstractions the characterise someother approaches. Howeverit is motivated by the "situated cognition" concern that knowledge is constructed in context, rather than a Platonic archetype (Comptonand Jansen 1990; Clancey 1993). It has the pleasing consequence of largely removing the need for a knowledge engineer and may have wide application beyond classification systems (Compton,Kanget al. 1993). 9. Compton, P. J. and Jansen, R. (1990). philosophical basis for knowledge acquisition. KnowledgeAcquisition 2: 241-257. (Proceedings of the 3rd European Knowledge Acquisition for Knowledge-BasedSystems Workshop, Paris 1989, pp 75-89) 10. Grossner, C., Preece, A., Chander, G., Radhakrishnan,T. and Suen, C. (1993). Exploring the structure of rule based systems. Proceedings of the American Association of Artificial Inte)ligence, Washington, MITPress, Cambridge. 704-709 Acknowledgments This work has been supported by the Australian Research Council 11. Hauser, T., Kraegen, E. W., Campbell, L. V., Compton,P. J. L., Sammut,C. and Chisholm, D. J. (1992). Assessment of experts’ approach to insulin therapy and the development of a simulator for diabetes insulin adjustment. Diabetes Care 15: 221231. (Diabetes Care) References 1. Compton,P., Edwards, G., Srlnivasan, A., Malor, R., Preston, P., Kang, B. and LLazarus, L.: Ripple down rules: turning knowledge acquisition Into knowledge maintenance. Artificial Intelligence in Medicine 4,47-59 (1992) 12. Menzies, T. (1992). Maintaining Procedural Knowledge: Ripple Down Functions. AI’92. Proceedingsof the 5th Australian Joint conference on artificial intelligence, Hobart, -World Scientific, Singapore. 335-342 2. Compton,P and Jansen, R: A philosophical basis for knowledgeacquisition. KnowledgeAcquisition 2 , 241-257(1990) 3. Gaines, B. and Compton,P.: Induction of Ripple DownRules. In: A. Adamsand L. Sterling (eds.):AI ’92. Proceedings of the 5th Australian Joint Conference on Artificial Intelligence. Hobart, 118