260 likes | 412 Views
Curs 13. Raționament fuzzy și elemente de FuzzyClips. Fuzzy sets – membership functions. A fuzzy set A in a universe of discourse U is characterized by a membership function: μ A :U→[0,1] fuzzy variable young. μ A. age. 20. 30. 40. 50. 60. 70. 80. 10. Uncertainty.
E N D
Curs 13 Raționament fuzzy și elemente de FuzzyClips
Fuzzy sets – membership functions • A fuzzy set A in a universe of discourse U is characterized by a membership function: μA :U→[0,1] • fuzzy variable young μA age 20 30 40 50 60 70 80 10
Uncertainty • Uncertainty occurs when one is not absolutely certain about a piece of information. • The degree of uncertainty is usually represented by a crisp numerical value on a scale from 0 to 1: a certainty factor 1 of 1 indicates that the expert system is very certain that a fact is true a certainty factor of 0 indicates that it is very uncertain that a fact is true.
Fuzzy function of the variable ‘age’ μage age 100 20 30 40 50 60 70 80 90 10
Fuzzy-CLIPS definition of the variable ‘age’ (deftemplate age 0 110 years ((very-young (10 1) (18 0)) (young (10 0) (18 1) (30 1) (40 0)) (adult (30 0) (35 1) (50 1) (60 0)) (old (50 0) (55 1) (70 1) (80 0)) (very-old (70 0) (75 1)) )
Fuzzy rules: the output variable DANGER OF CANCER in relation to EXPOSURE TO RADIATION and AGE
Defining rules in FuzzyCLIPS (defrule age_vyoung_exposure_low (age very_young) (exposure low) => (assert (danger medium)) ) (defrule age_vyoung_exposure_medium (age very_young) (exposure medium) => (assert (danger high)) )
The patient is 53 years old μage 0.6 0.4 age 20 30 40 50 60 70 80 90 10 53
Defining facts in FuzzyCLIPS (deffacts crisp-fact (age 53) ; a crisp fact ) (deffacts fuzzy-fact (age young) ; a fuzzy fact )
… and had an exposure level of 12… μexposure 0.7 0.3 Exposure (mSeaver/an) 1 mS/an 10 mS/an 20 mS/an 12
Fuzzification (defrule fuzzify-input-variable (age_crisp ?a) (exposure_crisp ?e) => (fuzzify age ?a) (fuzzify exposure ?e) )
Fuzzy function of the variable ‘danger’ μdanger danger (%) 100 20 30 40 50 60 70 80 90 10
Fired rules • if age=ADULT and exposure=MEDIUM then danger=LOW • if age=OLD and exposure=MEDIUM then danger=MEDIUM • if age=ADULT and exposure=HIGH then danger=MEDIUM • if age=OLD and exposure=HIGH then danger=HIGH
Fired rules • if age=ADULT (0.6) and exposure=MEDIUM (0.3) then danger=LOW • if age=OLD (0.4) and exposure=MEDIUM (0.3)then danger=MEDIUM • if age=ADULT (0.6) and exposure=HIGH (0.7) then danger=MEDIUM • if age=OLD (0.4) and exposure=HIGH(0.7) then danger=HIGH
Fuzzy inference if x=A AND y=B then z=C x=A’ y=B’ ----------- Fz’= Fx’∩Fy’ where: ∩ denotes the intersection of two fuzzy sets: a membership function of a fuzzy set C which is the intersection of fuzzy sets A and B is defined by the following formula: μC(x) = min(μA(x), μB(x)),for x ∈ U Fx’ is the result of fuzzy inference for the fact A’ and the simple rule: if x=A then C Fy’ is the result of fuzzy inference for the fact B’ and the simple rule: if y=B then C
Fired rules: the first rule • if age=ADULT (0.6) and exposure=MEDIUM (0.3) then danger=LOW • if age=ADULT then danger=LOW (0.6) • if exposure=MEDIUM then danger=LOW (0.3) μdanger 0.6 0.3 danger 100 20 30 40 50 60 70 80 90 10
Fired rules: the first rule • if age=ADULT (0.6) and exposure=MEDIUM (0.3) then danger=LOW • if age=ADULT then danger=LOW (0.6) • if exposure=MEDIUM then danger=LOW (0.3) μdanger 0.6 0.3 danger 100 20 30 40 50 60 70 80 90 10
Fired rules: the second rule • if age=OLD (0.4) and exposure=MEDIUM (0.3)then danger=MEDIUM • if age=OLD then danger= MEDIUM (0.4) • if exposure=MEDIUM then danger=MEDIUM (0.3) μdanger 0.4 0.3 danger 100 20 30 40 50 60 70 80 90 10
Fired rules: the second rule • if age=OLD (0.4) and exposure=MEDIUM (0.3)then danger=MEDIUM • if age=OLD then danger= MEDIUM (0.4) • if exposure=MEDIUM then danger=MEDIUM (0.3) μdanger 0.4 0.3 danger 100 20 30 40 50 60 70 80 90 10
Fired rules: the third rule • if age=ADULT (0.6) and exposure=HIGH (0.7) then danger=MEDIUM • if age=ADULT then danger= MEDIUM (0.6) • if exposure=HIGH then danger=MEDIUM (0.7) μdanger 0.7 0.6 danger 100 20 30 40 50 60 70 80 90 10
Fired rules: the third rule • if age=ADULT (0.6) and exposure=HIGH (0.7) then danger=MEDIUM • if age=ADULT then danger= MEDIUM (0.6) • if exposure=HIGH then danger=MEDIUM (0.7) μdanger 0.7 0.6 danger 100 20 30 40 50 60 70 80 90 10
Fired rules: the fourth rule • if age=OLD (0.4) and exposure=HIGH(0.7) then danger=HIGH • if age=OLD then danger=HIGH (0.4) • if exposure=HIGH then danger=HIGH (0.7) μdanger 0.7 0.4 danger 100 20 30 40 50 60 70 80 90 10
Fired rules: the fourth rule • if age=OLD (0.4) and exposure=HIGH(0.7) then danger=HIGH • if age=OLD then danger=HIGH (0.4) • if exposure=HIGH then danger=HIGH (0.7) μdanger 0.7 0.4 danger 100 20 30 40 50 60 70 80 90 10
Combining the contribution of rules • In case a fuzzy fact is asserted, this fact is treated as giving contributing evidence towards the conclusion about the fuzzy variable (it contributes globally). • If information about that fuzzy variable has already been asserted then the new evidence (or information) is combined with the existing information in the fuzzy fact. • The new value of the fuzzy fact is calculated in accordance with the formula: FC = FA ∪ FB FA and FB are values of the fuzzy fact ∪ denotes the union of two fuzzy sets: The membership function of a fuzzy set C which is the union of fuzzy sets A and B is defined by: μC(x) = max(μA(x), μB(x)), for x ∈ U
Combining the contribution of rules μdanger 0.6 0.4 0.3 danger 100 20 30 40 50 60 70 80 90 10
Combining the contribution of rules μdanger 0.6 0.4 0.3 danger 100 20 30 40 50 60 70 80 90 10 51.5%