Lecture Outline
Fuzzy Inference and Crisp Rules Revision
Defuzzification Fuzzy Sets revision
Fuzzy Inference
Michael J. Watts Fuzzy Rules
http://mike.watts.net.nz Fuzzy Composition
Defuzzification
Crisp Rules Crisp Rules
Consist of antecedents and consequents Only one rule at a time allowed to fire
Each part of an antecedent is a logical expression A rule will either fire or not fire
e.g. A > 0.5, light is on Have problems with uncertainty
Consequent will be asserted if antecedent is true Have problems with representing concepts like
IF (Presentation is Dull) AND (Voice is Monotone) small, large, thin, wide
THEN Lecture is boring Sequential firing of rules also a problem
order of firing
Fuzzy Sets Fuzzy Sets
Supersets of crisp sets Membership functions (MF)
Items can belong to varying degrees Mathematical functions
degrees of membership Return the degree of membership in a fuzzy set
[0,1] Many different types in existence
Fuzzy sets defined two ways Gaussian
membership functions Triangular
MF
sets of ordered pairs
Fuzzy Sets Fuzzy Sets
Can also be described as sets of ordered pairs Fuzzification
Pair Crisp,Fuzzy values Process of finding the degree of membership of a
A={(0,1.0),(1,1.0),(2,0.75),(3,0.5),(4,0.25),(5,0.0), value in a fuzzy set
(6,0.0),(7,0.0),(8,0.0),(9,0.0),(10,0.0)} Can be done by
With enough pairs, can approximate any MF MF
Interpolating set of pairs
Fuzzy Rules Fuzzy Rules
Also have antecedents and consequents Restaurant tipping example
Both deal with partial truths Antecedent variables are
Antecedents match fuzzy sets quality of service
quality of food
Consequents assign fuzzy sets
Fuzzy rules can have weightings
Consequent variables are
Tip
[0,1]
importance of rule
commonly set to 1
Fuzzy Rules Fuzzy Rules
Service can be Food can be
Poor rancid
good good
excellent delicious
Universe of Universe of
discourse is discourse is 0-10
0-10
Fuzzy Rules Fuzzy Rules
Tip can be Rules for the tipping system
cheap IF service is poor or food is rancid
average THEN tip is cheap
generous IF service is good
Universe of THEN tip is average
discourse is 0-25 IF service is excellent or food is delicious
% tip THEN tip is generous
Fuzzy Inference Fuzzy Inference
Infers fuzzy conclusions from fuzzy facts Implication is really two different processes
Matches facts against fuzzy antecedents inference
composition
Assigns fuzzy sets to outputs
Three step process
Inference is the matching of facts to antecedents
fuzzify the inputs (fuzzification)
Results in the truth value of each rule
apply fuzzy logical operators across antecedents degree of support
apply implication method Alpha
Fuzzy Inference Fuzzy Inference
Assigns fuzzy sets to each output variable Min inference
Fuzzy sets assigned to different degrees Cut output MF at degree of support
Determined by degree of support for rule
Methods for assigning (inferring) sets Where:
min is the output MF
Product is the inferred MF
v is the value being fuzzified
z is the degree of support
Fuzzy Inference Tipping Example
Product inferencing Assume
Multiply output MF by degree of support service is poor
score of 2
food is delicious
score of 8
How do we perform fuzzy inference with these
values?
Tipping Example Tipping Example
Firstly, fuzzify the input values Now, calculate the degree of support for each rule
Service fuzzifies to Rule 1:
Poor 0.8 IF service is poor or food is rancid
Good 0.2 poor = 0.8
Excellent 0.0 rancid = 0.0
Food fuzzifies to max(0.8, 0.0) = 0.8
Rancid 0.0 Degree of support = 0.8
Good 0.4
Delicious 0.6
Tipping Example Tipping Example
Rule 2 Rule 3
IF service is good IF service is excellent or food is delicious
good = 0.2 excellent = 0.0
max(0.2) = 0.2 delicious = 0.6
Degree of support = 0.2 max(0.0, 0.6) = 0.6
Degree of support = 0.6
Tipping Example Min Inference
Apply implication method Cut at 0.8
Builds an inferred fuzzy set
Find the min value for each output MF
Cut output MF at this value
Min Inference Min Inference
Corresponding fuzzy set
MF = {(0,0),(1,0.2),(2,0.4),(3,0.6),(4,0.8),(5,0.8),
(6,0.8),(7,0.6),(8,0.4),(9,0.2),(10,0), (25,0)}
Min Inference Min Inference
Degree of support of 0.4
Min Inference Fuzzy Inference
Corresponding set How are things different if we use product
MF = {(0,0),(1,0.2),(2,0.4),(3,0.4),(4,0.4),(5,0.4), inferencing?
(6,0.4),(7,0.4),(8,0.4),(9,0.2),(10,0), (25,0)}
Product Inference Product Inference
Corresponding set
MF = {(0,0),(1,0.16),(2,0.32),(3,0.48),(4,0.64),(5,0.8),
(6,0.64),(7,0.48),(8,0.16),(9,0.16),(10,0), (25,0)}
Product Inference Product Inference
Degree of support of 0.4
Corresponding set
MF = {(0,0),(1,0.08),(2,0.16),(3,0.24),(4,0.32),(5,0.4),
(6,0.32),(7,0.24),(8,0.16),(9,0.08),(10,0), (25,0)}
Fuzzy Composition Fuzzy Composition
Aggregates the inferred MF into one MAX takes the max fuzzy value for each value of
Two methods of doing this v
equivalent to taking the fuzzy values for the highest
Max activated rule for each output fuzzy set
Sum SUM sums all fuzzy values for each value of v
can lead to truth values > 1
may need to be normalised to [0,1]
implications for defuzzification
Fuzzy Composition Fuzzy Composition
Assume For Set A
3 MF attached to the output
A, B and C
Each MF has been asserted by two different rules For Set B
6 rules activated (degrees of support) > 0
Degrees of support
0.8, 0.4, 0.6, 0.5, 0.7, 0.3 For Set C
Prod inference used
Max Composition Max Composition
MAX composition
Take the max of each column
Sum Composition Sum Composition
Sum composition
sum each column
Defuzzification COG Defuzzification
Converts inferred MF into crisp numbers Centre of Gravity
CoG
Many different types in existence
Two common ones
Centre of Gravity
Mean of Maxima Where:
y is the crisp value
K is the number of items in the fuzzy set
COG Defuzzification COG Defuzzification
Applying this to the first composite set
COG Defuzzification Defuzzification
Mean of Maxima
MoM
Finds the mean of the crisp values that
correspond to the maximum fuzzy values
If there is one maximum fuzzy value, the
corresponding crisp value will be taken from the
fuzzy set
MoM Defuzzification MoM Defuzzification
Applying this to the first composite set What about sets with > 1 maximum?
Maximum fuzzy value is 0.8 Apply this to the third composite set
Corresponding crisp value is 4
This is the value returned by MoM
MoM Defuzzification MoM Defuzzification
Maximum fuzzy value if 0.8
Corresponding crisp values are
4, 5 and 6
Summary Summary
Fuzzy rules match fuzzy antecedents to fuzzy Fuzzy inference involves calculating an output
consequents fuzzy set
Degree to which antecedents are true determine Different inference process produces different
the degree of support inferred MF
Fuzzy logic functions are used to determine this Two inferences processes are
max-min
Max-prod
Summary Summary
Two common composition methods Different defuzzification methods produce
MAX different crisp values
sometimes wildly different
SUM
Inference methods described by combining Two different defuzzification methods
inference & composition methods Centre of Gravity
max-min (or min-max) CoG
max-prod Mean of Maxima
MoM
Defuzzification converts a composed MF to a
single crisp value