This wiki has undergone a migration to Confluence found Here
<meta name="googlebot" content="noindex">

Difference between revisions of "Arden Syntax:Fuzzy Arden Syntax"

From HL7Wiki
Jump to navigation Jump to search
 
(8 intermediate revisions by the same user not shown)
Line 4: Line 4:
  
 
== FAQ ==
 
== FAQ ==
 +
* '''Question:''' On the example fuzzy set on page 35-36 (''TwotoThree := fuzzy set (2, 0), (2, 1), (2, 1), (3, 1), (3, 0);''). Why did (2, 1) come twice time?
 +
** '''Answer:''' The first fuzzy set on page 36 is this<br><br> ''TwotoThree := fuzzy set (2, 0), (2, 1), (2, 1), (3, 1), (3,0);'' <br><br>At point 2 there is a "discontinuity point" which means that if we approaching 2 from the left side we have the membership value 0, while approaching 2 from the right side we have the membership value 1. The question is which membership value is assigned to 2. The document contains the sentence "''The first assignment is the value at that point, unless the second one appears twice.''". <br><br>This means in the above example (fuzzy set TwotoThree) the membership value at point 2 is '''1''', since the (2, 1) appears twice. <br> If we adjust the fuzzy set to <br><br>''TwotoThree := fuzzy set (2, 0), (2, 1), (3, 1), (3,0);''<br><br>the membership value at the point 2 is '''0'''.
 +
 +
* '''Question:''' Could you provide some examples for using IF-THEN-ELSE(-AGGREGATE) (see section 10.2.2.*) and the expected output?
 +
** '''Answer:''' Please see [[Arden_Syntax:Fuzzy_Arden_Syntax#EXAMPLES | examples]] below for more information.
 +
 +
== References ==
 +
* L.A. Zadeh. Fuzzy sets. Information and Control, 8:338–353, 1965.
 +
* L.A. Zadeh. Fuzzy algorithms. Information and Control, 12:94–102, 1968.
 +
* L.A. Zadeh. Quantitative fuzzy semantics.  Information Sciences, 3:159–176, 1971.
 +
* L.A. Zadeh. Outline of a new approach to the analysis of complex systems and decision processes.  IEEE Transactions on Systems, Man, and Cybernetics, 3:28–44, 1973.
 +
* L.A. Zadeh. The linguistic approach and its application to decision analysis. In Y.C. Ho and S.K. Mitter, editors, Directions in Largescale Systems, pages 339–370, Plenum Press, New York, 1976.
 +
* L.A. Zadeh. Knowledge representation in fuzzy logic. IEEE Transactions On Knowledge And Data Engineering, 1:89–99, 1989.
 +
* L.A. Zadeh. The birth and evolution of fuzzy logic.  General Systems, pages 95–105, 1990.
 +
* L.A. Zadeh. Fuzzy logic = computing with words.  IEEE Transactions on Fuzzy Systems, 4:103–111, 1996.
 +
* L.A. Zadeh. From computing with numbers to computing with words—from manipulation of measurements to manipulation of perceptions. IEEE Trans- actions on Circuits and Systems, 45:105–119, 1999.
 +
* H.T. Nguyen, E.A. Walker. A first course in fuzzy logic. Chapman & Hall/CRC, Boca Raton 2006.
 +
 +
== EXAMPLES ==
 +
 +
'''"Classic" example using a boolean  '''
 +
  Logic:
 +
    Var := 0;
 +
    Bool_true := true;
 +
    Con := truth value 0.2;
 +
    If Bool_true then
 +
      Var := Var + 1;
 +
    Else
 +
      Var := Var + 3;
 +
    Endif
 +
    CONCLUDE TRUE;
 +
  Action:
 +
      WRITE Var;
 +
''expected output:'' <br>
 +
'''3 <applicability=1>'''
 +
 +
----
 +
'''Example using a truth value '''
 +
  Logic:
 +
    Var := 0;
 +
    Bool_true := true;
 +
    Con := truth value 0.2;
 +
    If Con then
 +
      Var := Var + 1;
 +
    Else
 +
      Var := Var + 3;
 +
    Endif
 +
    CONCLUDE TRUE;
 +
  Action:
 +
      WRITE Var;
 +
The MLM execution branches at the IF statement and all following expressions are executed twice (in parallel) up to the end of the MLM.<br>
 +
''expected output:'' <br>
 +
'''1 <applicability=0.2>''' <br>
 +
'''3 <applicability=0.8>'''
 +
 +
----
 +
'''Example using a truth value with AGGREGATE '''
 +
  Logic:
 +
    Var := 0;
 +
    Bool_true := true;
 +
    Con := truth value 0.2;
 +
    If Con then
 +
      Var := Var + 1;
 +
    Else
 +
      Var := Var + 3;
 +
    Endif AGGREGATE
 +
    CONCLUDE TRUE;
 +
  Action:
 +
      WRITE Var;
 +
The MLM execution branches at the IF statement and the expressions in the THEN and ELSE branch are executed in parallel. When execution reaches the ENDIF AGGREGATE statement the aggregated value of Var is calculated. This is done as described in the specification by "Otherwise, if Var is defined in all branches and of the same simple data type except string, the
 +
contents are aggregated according to their weighted middle.". <br>
 +
Therefore, after the ENDIF AGGREGATE statement Var has the value (0.2*1 + 0.8*3) / (0.2 + 0.8) = 2.6. <br>
 +
''expected output:'' <br>
 +
'''2.6 <applicability=1>'''
 +
 +
----
 +
'''Example using truth values with nested IF . . . ELSE statements'''
 +
  Logic:
 +
    Var := 0;
 +
    Bool_true := true;
 +
    Con := truth value 0.2;
 +
    If Con then
 +
      Var := Var + 1;
 +
      If con_second then
 +
        Var := Var + 1;
 +
      Else
 +
        Var := Var + 3;
 +
      Endif
 +
    Else
 +
      Var := Var + 3;
 +
    Endif
 +
    CONCLUDE TRUE;
 +
  Action:
 +
      WRITE Var;
 +
 +
As above, the MLM execution splits into 2 branches on the first IF statement. The second IF statement branches the first branch again into 2 separate executions. Those 3 Branches are executed in parallel.  <br>
 +
''expected output:'' <br>
 +
'''2 <applicability=0.06> (THEN->THEN)''' <br>
 +
'''4 <applicability=0.14> (THEN->ELSE)''' <br>
 +
'''3 <applicability=0.8> (ELSE)''' <br>
 +
Please note that the sum of all applicabilities of a variable is 1.
 +
----
 +
'''How is the CONCLUDE statement handled in parallel processing?'''
 +
  Logic:
 +
    Var := 0;
 +
    Bool_true := true;
 +
    Con := truth value 0.2;
 +
    If Con then
 +
      Var := Var + 1;
 +
      CONCLUDE FALSE;
 +
    Else
 +
      Var := Var + 3;
 +
    Endif
 +
    CONCLUDE TRUE;
 +
  Action:
 +
      WRITE Var;
 +
As specified, the CONCLUDE statement stops the execution of the MLM. That means, the affected branch of execution is stopped. The other one is executed until the end of the MLM.<br>
 +
''expected output:'' <br>
 +
'''3 <applicability=0.8>''' <br>

Latest revision as of 12:37, 26 July 2012

Introduction

The principal change of version 2.9 is the introduction of support for fuzzy logic. Fuzzy logic is a multi-valued logic that has gained use in formal decision-making because of its value in representing reasoning involving imprecision. Unlike the typical binary (true-false) logic that continues to be supported in this version of the Arden Syntax, fuzzy logic incorporates degrees of truth or set membership (Steimann F. On the use and usefulness of fuzzy sets in medical AI . Artif Intell Med 2001;21:131-7). Clinical practice guidelines and other forms of clinical knowledge representation may employ fuzzy logic, using linguistic variables such as "severe" and "somewhat" without necessarily formally defining them or providing an objective quantification. These changes in the Arden Syntax allow fuzzy logic to be formally represented, thus supporting the representation of clinical guidelines and clinical reasoning generally.

FAQ

  • Question: On the example fuzzy set on page 35-36 (TwotoThree := fuzzy set (2, 0), (2, 1), (2, 1), (3, 1), (3, 0);). Why did (2, 1) come twice time?
    • Answer: The first fuzzy set on page 36 is this

      TwotoThree := fuzzy set (2, 0), (2, 1), (2, 1), (3, 1), (3,0);

      At point 2 there is a "discontinuity point" which means that if we approaching 2 from the left side we have the membership value 0, while approaching 2 from the right side we have the membership value 1. The question is which membership value is assigned to 2. The document contains the sentence "The first assignment is the value at that point, unless the second one appears twice.".

      This means in the above example (fuzzy set TwotoThree) the membership value at point 2 is 1, since the (2, 1) appears twice.
      If we adjust the fuzzy set to

      TwotoThree := fuzzy set (2, 0), (2, 1), (3, 1), (3,0);

      the membership value at the point 2 is 0.
  • Question: Could you provide some examples for using IF-THEN-ELSE(-AGGREGATE) (see section 10.2.2.*) and the expected output?
    • Answer: Please see examples below for more information.

References

  • L.A. Zadeh. Fuzzy sets. Information and Control, 8:338–353, 1965.
  • L.A. Zadeh. Fuzzy algorithms. Information and Control, 12:94–102, 1968.
  • L.A. Zadeh. Quantitative fuzzy semantics. Information Sciences, 3:159–176, 1971.
  • L.A. Zadeh. Outline of a new approach to the analysis of complex systems and decision processes. IEEE Transactions on Systems, Man, and Cybernetics, 3:28–44, 1973.
  • L.A. Zadeh. The linguistic approach and its application to decision analysis. In Y.C. Ho and S.K. Mitter, editors, Directions in Largescale Systems, pages 339–370, Plenum Press, New York, 1976.
  • L.A. Zadeh. Knowledge representation in fuzzy logic. IEEE Transactions On Knowledge And Data Engineering, 1:89–99, 1989.
  • L.A. Zadeh. The birth and evolution of fuzzy logic. General Systems, pages 95–105, 1990.
  • L.A. Zadeh. Fuzzy logic = computing with words. IEEE Transactions on Fuzzy Systems, 4:103–111, 1996.
  • L.A. Zadeh. From computing with numbers to computing with words—from manipulation of measurements to manipulation of perceptions. IEEE Trans- actions on Circuits and Systems, 45:105–119, 1999.
  • H.T. Nguyen, E.A. Walker. A first course in fuzzy logic. Chapman & Hall/CRC, Boca Raton 2006.

EXAMPLES

"Classic" example using a boolean

 Logic:
   Var := 0;
   Bool_true := true;
   Con := truth value 0.2;
   If Bool_true then
     Var := Var + 1;
   Else
     Var := Var + 3;
   Endif
   CONCLUDE TRUE;
 Action:
     WRITE Var;

expected output:
3 <applicability=1>


Example using a truth value

 Logic:
   Var := 0;
   Bool_true := true;
   Con := truth value 0.2;
   If Con then
     Var := Var + 1;
   Else
     Var := Var + 3;
   Endif
   CONCLUDE TRUE;
 Action:
     WRITE Var;

The MLM execution branches at the IF statement and all following expressions are executed twice (in parallel) up to the end of the MLM.
expected output:
1 <applicability=0.2>
3 <applicability=0.8>


Example using a truth value with AGGREGATE

 Logic:
   Var := 0;
   Bool_true := true;
   Con := truth value 0.2;
   If Con then
     Var := Var + 1;
   Else
     Var := Var + 3;
   Endif AGGREGATE
   CONCLUDE TRUE;
 Action:
     WRITE Var;

The MLM execution branches at the IF statement and the expressions in the THEN and ELSE branch are executed in parallel. When execution reaches the ENDIF AGGREGATE statement the aggregated value of Var is calculated. This is done as described in the specification by "Otherwise, if Var is defined in all branches and of the same simple data type except string, the contents are aggregated according to their weighted middle.".
Therefore, after the ENDIF AGGREGATE statement Var has the value (0.2*1 + 0.8*3) / (0.2 + 0.8) = 2.6.
expected output:
2.6 <applicability=1>


Example using truth values with nested IF . . . ELSE statements

 Logic:
   Var := 0;
   Bool_true := true;
   Con := truth value 0.2;
   If Con then
     Var := Var + 1;
     If con_second then
       Var := Var + 1;
     Else
       Var := Var + 3;
     Endif 
   Else
     Var := Var + 3;
   Endif 
   CONCLUDE TRUE;
 Action:
     WRITE Var;

As above, the MLM execution splits into 2 branches on the first IF statement. The second IF statement branches the first branch again into 2 separate executions. Those 3 Branches are executed in parallel.
expected output:
2 <applicability=0.06> (THEN->THEN)
4 <applicability=0.14> (THEN->ELSE)
3 <applicability=0.8> (ELSE)
Please note that the sum of all applicabilities of a variable is 1.


How is the CONCLUDE statement handled in parallel processing?

 Logic:
   Var := 0;
   Bool_true := true;
   Con := truth value 0.2;
   If Con then
     Var := Var + 1;
     CONCLUDE FALSE;
   Else
     Var := Var + 3;
   Endif
   CONCLUDE TRUE;
 Action:
     WRITE Var;

As specified, the CONCLUDE statement stops the execution of the MLM. That means, the affected branch of execution is stopped. The other one is executed until the end of the MLM.
expected output:
3 <applicability=0.8>