Linguistic Variables with Arden Syntax Fuzzy Logical Extensions to the Arden Syntax Sven Tiffe Siemens medical Solutions that help Siemens Medical Solutions BD XPL² Henkestr. 127 D-91052 Erlangen Germany Sven.Tiffe@siemens.com 2 Proposed extensions – so far Extensions based on fuzzy theoretical concepts Comparison operators: fuzzy comparison by one or two additional parameters (binary or ternary operators) Truth values: gradual transition from false to true Arden operators: every operator is can handle data with “fuzziness” or fuzzy truth values Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Data types: additional attribute “fuzziness” to measure fuzzy context of data creation 3 Capabilities – so far Fuzzily defined selection criteria and conditions by fuzzy comparison operators Processing of measured “fuzziness” Fuzzy if-then statements Fuzzy logical operators Aggregation operators Fuzzy sets for fuzzy comparisons have to be defined each time they are used Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Defuzzification 4 Concept of Linguistic Variables Description of the relationship between abstract concepts (terms) and (numeric) data Name of linguistic variable Values (terms) described by fuzzy set (1) pronounced hypothermia (2) deep hypothermia (3) moderate hypothermia (4) slight hypothermia (5) normal (6) subfebrile (7) moderate fever (8) high fever Independent from terminology Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Example: “temperature” 5 Usage Usable as linguistic expressions in algorithms, e.g.: Siemens medical Solutions that help if temperature is ’subfebrile’ then if weight is ’normal’ and blood_pressure is ’increased’ then Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Evaluation in TOSCA project in addition to a commercial fuzzy control system Auhtors: G. Zahlmann, Siemens, and M. Scherf, GSF Fuzzy control systems 6 Representation using fuzzy comparisons “temperature is normal” could be defined as: temp_sf := temp is within 36.8 fuzzified by 0.8 to 37.1 fuzzified by 0.5; The fuzzy set has to be (re)defined for every usage. Define linguistic variable separately: temp := liguistic variable ‘temperature’; And compare to term instead compare to numeric values: Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions temp_sf := temp is ‘normal; 7 Representation as MLM Each linguistic variable represented by one MLM Slots in knowledge category: type: linguistic variable values: single terms of LV as Arden terms input: input value(s) for this variable • numerical data from read statement • linguistic variable as result from other MLMs defuzzification: method for defuzzification (optional) unit: natural language unit of (numeric) data as Arden term sets: fuzzy sets for every single term Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions range: range of valid (numerical) input/output value 8 Example linguistic variable Linguistic variable “Intraocular Pressure (IOP)” m(x) increased 0.0 0 10 20 30 40 knowledge: type: linguistic variable;; values: 'normal', 'increased';; input: read { %event.iop_value:iop_time% };; range: 0.0, 70.0;; unit: 'mmHg';; sets: normal:= linear((0.0, 1.0), (20.0, 1.0), (22.07, 0.0), (70.0, 0.0)); increased:= linear((0.0, 0.0), (20.0, 0.0), (22.07, 1.0), (70.0, 1.0));; Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com mmHg © 2001 Siemens Medical Solutions normal 1.0 9 Usage – declaration Input variables are initialized: input slot gets executed in these MLMs CDR := init linguistic variable 'LV_CDR'; diff_lr := init linguistic variable 'LV_diff_lr'; IOP := init linguistic variable 'LV_IOP'; le := init linguistic variable 'LV_le'; Output variables are not initialized Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions normotens_glauco := linguistic variable 'LV_ normotens_glauco’; 10 Usage – evaluation, value assignment Comparison between linguistic variable and term <id> IS <term> returns a fuzzy truth value Assign term to a linguistic variable (with optional weight) SET <id> TO <term> (WITH <number>) Value is influenced by “fuzziness” of code block (condition) if (CDR is ‘normal' and diff_lr is 'normal' and IOP is 'normal‘ and le is ‘centered’) then endif; Get numerical value by defuzzification DEFUZZIFY <id> Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions set normotens_glauco to ‘nowith 1.0; 11 knowledge: type: data-driven;; data: (CDR, diff_lr, IOP, le) := argument; if CDR is null then /* if module not used with arguments */ CDR := init linguistic variable 'LV_CDR'; diff_lr := init linguistic variable 'LV_diff_lr'; IOP := init linguistic variable 'LV_IOP'; le := init linguistic variable 'LV_le'; endif; normotens_glauco := linguistic variable 'LV_normotens_glauco'; ;; evoke: /* direct call */;; logic: if (CDR is 'normal' AND diff_lr is 'normal' AND IOP is 'normal' AND le is 'centered') then set normotens_glauco to 'no' with 1.0; endif; if (CDR is 'normal' AND diff_lr is 'normal' AND IOP is 'normal' AND le is 'tempinferior') then set normotens_glauco to 'yes' with 0.398; endif; if (CDR is 'normal' AND diff_lr is 'normal' AND IOP is 'normal' AND le is 'tempsuperior') then set normotens_glauco to 'yes' with 0.398; endif; … … Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Example: Rule block in DIADEM project 12 Evaluation [1] MC Jaulent, et.al., Modeling uncertainty in computerized guidelines using fuzzy logic, proceedings of AMIA symposium 2001 Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions CADIAG-II/RHEUMA: expert system with large knowledge base (about 3000 MLMs); using basically fuzzy comparisons and logical operators, but is based (and thus extendable) on linguistic variables TOSCA: fuzzy control rule set for glaucoma screening, 17 linguistic variables and 11 production rule blocks; using linguistic variables Hypertension guideline (University Pierre & Marie Curi, Medical School, Paris); using fuzzy comparisons [1] 13 Conclusion – Linguistic Variables Pluses Formalization of relationship between terms and data Centralized definition Arden knowledge bases describe relationship between data and linguistic concepts, independently from terminology No need to define fuzzy sets in each MLM, where the fuzzy set (term) is used Additional data type – how shall Arden operators handle these variable? (similar problem to usage of “object” variables) So far, no additional operator uses these values. Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Minuses 14 Summary Integration fuzzy theoretical concepts Fuzzy comparison operators (applying concept of fuzzy sets) Fuzzy truth values Linguistic variables Large knowledge bases in different projects (CADIAG, DIADEM) Small knowledge bases or single rules have still to be defined Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Not a fuzzy mathematical framework – only slight modifications to the programming language Yes, it runs! Evaluation 15 Summary, cont. Other uncertainty models “Fuzzy logic” is not the only model to represent uncertainty (probabilistic approaches, Demster-Shafer, neuronal nets) But: fuzzy logical extensions are easy embeddable in a procedural and rule based environment like Arden Additional data attribute “uncertainty” has to be handled by every operator Linguistic variables result in an entirely new data type • Do not modify operators and ignore these data types Similar problem: introduction of object oriented data types Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions • Extension of every single operator 16 Outlook Context dependent linguistic variables Crisp fuzzy set selection by selection criteria (e.g., sex, pregnancy) Two-dimensional fuzzy sets • fuzzy sets are dependent on fuzzily defined patient age range Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Results of evaluation Backup slides Siemens medical Solutions that help 18 Example: fuzzy fan control Production rules: If temperature is cool set speed to slow If temperature is moderate set speed to medium If temperature is hot set speed to fast Linguistic variables: Linguistic variable “temperature” Linguistic variable “speed” 1.0 m(x) cool moderate hot 1.0 0.0 10 Siemens medical Solutions that help 20 30 40 °C slow medium fast 1000 2000 3000 0.0 Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com 4000 RPM © 2001 Siemens Medical Solutions m(x) 19 Fan control: input fuzzification Assume, measured temperature is 28°C Linguistic variable “temperature” m(x) cool moderate hot 0.0 10 20 30 40 °C Temperature is cool: 0.00 Temperature is moderate: 0.40 Temperature is hot: 0.60 Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions 1.0 20 Fan control: production rules If temperature is cool set speed to slow Linguistic variable “temperature” Linguistic variable “speed” 1.0 m(x) cool moderate hot 1.0 0.0 10 20 30 40 °C slow medium fast 1000 2000 3000 0.0 4000 RPM As temperature is definitely not cool, speed has not value slow Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions m(x) 21 Fan control: production rules If temperature is moderate set speed to medium Linguistic variable “temperature” Linguistic variable “speed” m(x) 1.0 m(x) cool moderate hot 1.0 0.0 10 20 30 40 °C slow medium fast 1000 2000 3000 0.0 4000 RPM Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Speed is set to medium by a degree of 0.40 22 Fan control: production rules If temperature is hot set speed to fast Linguistic variable “temperature” Linguistic variable “speed” m(x) 1.0 m(x) cool moderate hot 1.0 0.0 10 20 30 40 °C slow medium fast 1000 2000 3000 0.0 4000 RPM Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Speed is set to fast by a degree of 0.60 23 Fan control: output value The output variable “speed” has the value (0.0, 0.4, 0.6) Linguistic variable “speed” m(x) slow medium fast 1000 2000 3000 0.0 4000 RPM In order to control the fan speed, the linguistic variable has to be defuzzified Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions 1.0 24 Fan control: defuzzification Center of Gravity: 2600,1 RPM Center of Maximum: 2600 RPM Mean of Maximum: The examples have been computed using fuzzyTECH® 5.51 Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions 3000 RPM 25 Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Fan control: sample MLMs 26 Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Fan control: sample MLMs 27 Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Fan control: sample MLMs 28 Siemens medical Solutions that help Sven Tiffe, MED BD XPL², Sven.Tiffe@siemens.com © 2001 Siemens Medical Solutions Fan control: sample MLMs