Fuzzy-Sets Tutorial
Fuzzy-Sets Tutorial
1
1. Introduction
Uncertainty
When A is a fuzzy set and x is a relevant object, the proposition “
x is a member of A” is not necessarily either true or false. It may
be true only to some degree, the degree to which x is actually a
member of A.
For example: the weather today
Sunny: If we define any cloud cover of 25% or less is sunny.
This means that a cloud cover of 26% is not sunny?
“Vagueness” should be introduced.
2
The crisp set v.s. the fuzzy set
The crisp set is defined in such a way as to partition the individuals in some
given universe of discourse into two groups: members and nonmembers.
However, many classification concepts do not exhibit this characteristic.
For example, the set of tall people, expensive cars, or sunny days.
3
2. Fuzzy sets: basic types
A membership function:
A characteristic function: the values assigned to the elements
of the universal set fall within a specified range and indicate th
e membership grade of these elements in the set.
Larger values denote higher degrees of set membership.
A set defined by membership functions is a fuzzy set.
The most commonly used range of values of membership function
s is the unit interval [0,1].
The universal set X is always a crisp set.
Notation:
The membership function of a fuzzy set A is denoted by :
A
A : X [0,1]
Alternatively, the function can be denoted by A and has the form
A : X [0,1]
4
We use the second notation.
2. Fuzzy sets: basic types
5
3. Fuzzy sets: basic concepts
Given two fuzzy sets, A and B, their standard intersection and union
are defined for all x X by the equations
( A B)( x) min[ A( x), B( x)],
( A B)( x) max[ A( x), B( x)],
where min and max denote the minimum operator and the maximu
m operator, respectively.
6
3. Fuzzy sets: basic concepts
Another example: B A1 A2
A1, A2, A3 are normal. Normality and convexity
B and C are subnormal. may be lost when we
B and C are convex. operate on fuzzy sets by
the standard operations
B C and B C are not
of intersection and
convex. C A2 A3 complement.
7
3. Fuzzy sets: basic concepts
Discussions:
Normality and convexity m
ay be lost when we operate
on fuzzy sets by the standa
rd operations of intersectio
n and complement.
The fuzzy intersection and
fuzzy union will satisfies all
the properties of the Boole
an lattice listed in Table 1.1
except the low of contradict
ion and the low of excluded
middle.
8
3. Fuzzy sets: basic concepts
The law of contradiction
A A
To verify that the law of contradiction is violated for fuzzy sets, we ne
ed only to show that
min[A( x),1 A( x)] 0
is violated for at least one x X .
This is easy since the equation is obviously violated for any value
A( x) (0,1) , and is satisfied only for A( x) {0,1}.
9
3. Fuzzy sets: basic concepts
To verify the law of absorption,
A ( A B) A
This requires showing that max[A( x), min[A( x), B( x)]] A( x)
is satisfied for all x X .
Consider two cases:
(1) A( x) B( x)
max[ A( x), min[ A( x), B( x)]] max[ A( x), A( x)] A( x)
(2) A( x) B( x)
max[ A( x), min[ A( x), B( x)]] max[ A( x), B( x)] A( x)
10
3. Fuzzy sets: basic concepts
Given two fuzzy set
we say that A is a subset of B and write A B iff
A( x) B( x)
for all x X.
A B iff A B A and A B B for any
11
Fuzzy Relations
0 10 20 30 40 50 60 70 80
0 0 0.1 0.2 0.3 0.4 0.5 0.7 0.9 1
10 0 0 0.1 0.2 0.3 0.4 0.5 0.7 0.9
20 0 0 0 0.1 0.2 0.3 0.4 0.5 0.7
30 0 0 0 0 0.1 0.2 0.3 0.4 0.5
40 0 0 0 0 0 0.1 0.2 0.3 0.4
50 0 0 0 0 0 0 0.1 0.2 0.3
60 0 0 0 0 0 0 0 0.1 0.2
70 0 0 0 0 0 0 0 0 0.1
80 0 0 0 0 0 0 0 0 0
12
Let s = [i(1),i(2),..,i(k)] be a subsequence of [1,2,…,n] and let
s* = [i(k+1), i(k+2),…, i(n)] be the sequence complementary to
[i(1),i(2),..,i(k)].
The projection of n-ary fuzzy relation R on U(s) = U(i1) U(i2) .. U(ik)
denoted Proj[U(s)](R) is k-ary fuzzy relation
Fast1 = Fast2 ={(0,0), (10,0.01), (20, 0.02), (30, 0.05), (40, 0.1), (50, 0.4),
(60, 0.8), (70, 0.9), (80, 1)}.
0 10 20 30 40 50 60 70 80
0 10 20 30 40 50 60 70 80
0 0 0 0 0 0 0 0 0 0
80 1 1 1 1 1 1 1 1 1
0 10 20 30 40 50 60 70 80
0 0 0 0 0 0 0 0 0 0
16
Let R be fuzzy relation on U(1) U(2) … U(r), and S be fuzzy
relation on U(s) U(s+1) … U(n).
Let {i1, i2,.., ik}= ({1,2…,r}- {s, s+1,…,n}) ({s, s+1,…,n}- {1,2,…,r})
Symmetric difference
17
u _Fast
0 0
10 0.01 Need to be extended
20 0.02
30 0.05
Find composition R S = ?
40 0.1
50 0.4
=R
60 0.8
70 0.9
80 1
0 10 20 30 40 50 60 70 80
0 0 0.1 0.2 0.3 0.4 0.5 0.7 0.9 1
10 0 0 0.1 0.2 0.3 0.4 0.5 0.7 0.9
20 0 0 0 0.1 0.2 0.3 0.4 0.5 0.7
30 0 0 0 0 0.1 0.2 0.3 0.4 0.5
40 0 0 0 0 0 0.1 0.2 0.3 0.4
18
Conception of Fuzzy Logic
Many decision-making and problem-solving
tasks are too complex to be defined precisely
“false” “true” 20
Fuzzy Logic
An approach to uncertainty that combines
real values [0…1] and logic operations
21
Example: “Young”
Example:
Ann is 28, 0.8 in set “Young”
Bob is 35, 0.1 in set “Young”
Charlie is 23, 1.0 in set “Young”
Fuzzy values
DOM
Degree of
Membership
Young Middle Old
1
0.5
0
25 40 55 Age
25
Benefits of fuzzy logic
You want the value to switch gradually as
Young becomes Middle and Middle becomes
Old. This is the idea of fuzzy logic.
Fuzzy Set Operations
Fuzzy union (): the union of two fuzzy sets
is the maximum (MAX) of each element from
two sets.
E.g.
A = {1.0, 0.20, 0.75}
B = {0.2, 0.45, 0.50}
A B = {MAX(1.0, 0.2), MAX(0.20, 0.45), MAX(0.75, 0.50)}
= {1.0, 0.45, 0.75}
27
Fuzzy intersection (): the intersection of two
fuzzy sets is just the MIN of each element
from the two sets.
E.g.
A B = {MIN(1.0, 0.2), MIN(0.20, 0.45),
MIN(0.75, 0.50)} = {0.2, 0.20, 0.50}
28
Fuzzy Set Operations
The complement of a fuzzy variable with
DOM x is (1-x).
Complement ( _c): The complement of a
fuzzy set is composed of all elements’
complement.
Example.
Ac = {1 – 1.0, 1 – 0.2, 1 – 0.75} = {0.0, 0.8, 0.25}
29
Crisp Relations
Ordered pairs showing connection between two
sets:
(a,b): a is related to b
(2,3) are related with the relation “<“
…31
Fuzzy Relations Matrices
Example: Color-Ripeness relation for tomatoes
32
Where is Fuzzy Logic used?
Fuzzy logic is used directly in very few
applications.
33
Fuzzy Expert System
Fuzzy expert system is a collection of
membership functions and rules that are
used to reason about data.
34
Operation of Fuzzy System
Crisp Input
Fuzzy Input
Fuzzy Output
35
Crisp Output
Building Fuzzy Systems
Fuzzification
Inference
Composition
Defuzzification
36
Fuzzification
Establishes the fact base of the fuzzy system. It identifies the
input and output of the system, defines appropriate IF THEN
rules, and uses raw data to derive a membership function.
Consider an air conditioning system that determine the best
circulation level by sampling temperature and moisture levels.
The inputs are the current temperature and moisture level.
The fuzzy system outputs the best air circulation level:
“none”, “low”, or “high”. The following fuzzy rules are used:
1. If the room is hot, circulate the air a lot.
2. If the room is cool, do not circulate the air.
3. If the room is cool and moist, circulate the air slightly.
A knowledge engineer determines membership functions that map
temperatures to fuzzy values and map moisture measurements to fuzzy
values. 37
Inference
Evaluates all rules and determines their truth values.
If an input does not precisely correspond to an IF
THEN rule, partial matching of the input data is used
to interpolate an answer.
Continuing the example, suppose that the system has
measured temperature and moisture levels and mapped them
to the fuzzy values of .7 and .1 respectively. The system now
infers the truth of each fuzzy rule. To do this a simple method
called MAX-MIN is used. This method sets the fuzzy value of
the THEN clause to the fuzzy value of the IF clause. Thus, the
method infers fuzzy values of 0.7, 0.1, and 0.1 for rules 1, 2,
and 3 respectively.
38
Composition
Combines all fuzzy conclusions obtained by inference
into a single conclusion. Since different fuzzy rules
might have different conclusions, consider all rules.
Continuing the example, each inference suggests a different
action
rule 1 suggests a "high" circulation level
rule 2 suggests turning off air circulation
rule 3 suggests a "low" circulation level.
A simple MAX-MIN method of selection is used where the
maximum fuzzy value of the inferences is used as the final
conclusion. So, composition selects a fuzzy value of 0.7 since
this was the highest fuzzy value associated with the inference
conclusions.
39
Defuzzification
Convert the fuzzy value obtained from composition
into a “crisp” value. This process is often complex
since the fuzzy set might not translate directly into a
crisp value.Defuzzification is necessary, since
controllers of physical systems require discrete
signals.
Continuing the example, composition outputs a fuzzy value of
0.7. This imprecise value is not directly useful since the air
circulation levels are “none”, “low”, and “high”. The
defuzzification process converts the fuzzy output of 0.7 into
one of the air circulation levels. In this case it is clear that a
fuzzy output of 0.7 indicates that the circulation should be set
to “high”. 40
Defuzzification
There are many defuzzification methods. Two of the
more common techniques are the centroid and
maximum methods.
In the centroid method, the crisp value of the output
variable is computed by finding the variable value of
the center of gravity of the membership function for
the fuzzy value.
In the maximum method, one of the variable values
at which the fuzzy subset has its maximum truth
value is chosen as the crisp value for the output
variable.
41
Example
42
Fuzzification
Two Inputs (x, y) and one output (z)
Membership functions:
low(t) = 1 - ( t / 10 )
high(t) = t / 10
0.68
Low High
0.32
0
Crisp Inputs X=0.32 Y=0.61 t
43
Low(x) = 0.68, High(x) = 0.32, Low(y) = 0.39, High(y) = 0.61
Create rule base
Rule 1: If x is low AND y is low Then z is high
44
Inference
Rule1: low(x)=0.68, low(y)=0.39 => Rule strength
high(z)=MIN(0.68,0.39)=0.39
1
Low High
0.61
0.39
0
t 46
Defuzzification Max
tf (t )dt
Center of Gravity C Min
Max
f (t )dt
Min
1
Low High
Center of Gravity
0.61
0.39
0
t
Crisp output 47
A Real Fuzzy Logic System
The subway in Sendai, Japan uses a fuzzy
logic control system developed by Serji
Yasunobu of Hitachi.
It took 8 years to complete and was finally put
into use in 1987.
48
Control System
Based on rules of logic obtained from train
drivers so as to model real human decisions
as closely as possible
49
The results of the fuzzy logic controller for the
Sendai subway are excellent!!
The train movement is smoother than most
other trains
Even the skilled human operators who
sometimes run the train cannot beat the
automated system in terms of smoothness or
accuracy of stopping
50
Fuzzy Logic
Interpretation Domain Fuzzy Sets
u _Fast u _Dangerous
0 0
0 0
10 0.01
10 0.05
20 0.02
20 0.1
30 0.05
30 0.15
40 0.1
40 0.2
50 0.4
50 0.3
60 0.8
60 0.7
70 0.9 70 1
80 1 80 1
51
Fuzzy logic proposition: X is fast or Y is dangerous
0 10 20 30 40 50 60 70 80
80 1 1 1 1 1 1 1 1 1
52
Homework:
53
Example II
cold cheap
if temperature is cold and oil is cheap
Linguistic Linguistic 55
Variable Value
Definition [Zadeh 1973]
A linguistic variable is characterized by a quintuple
x, T ( x),U , G, M
Name
Term Set
Universe
Syntactic Rule
Semantic Rule
56
Example
A linguistic variable is characterized by a quintuple
x, T ( x),U , G, M
age
Example semantic rule:
old, very old, not so old,
G (age) more or less young, M (old) u, old (u ) u [0,100]
quite young, very young
0 u [0,50]
1
old (u ) u 50 2
[0, 100] 1 5 u [50,100]
57
Example II
Linguistic Variable : temperature
Linguistics Terms (Fuzzy Sets) : {cold, warm, hot}
(x)
cold warm hot
1
20 60 x
58
Classical Implication
AB
A B A
T
B
T
A B
T
A
1
B
1
A B
1
T F F 1 0 0
F T T 0 1 1
F F T 0 0 1
59
A B AB
AB 1 1 1
1 0 0
1 A ( x) B ( y ) 0 1 1
A B ( x, y ) 0 0 1
B ( y ) otherwise
A B A
1
B
1
A B
1
1 0 0
A B ( x, y ) max 1 A ( x), B ( x) 0 1 1
0 0 1 60
A B AB
1 1 1
Modus Ponens 1 0 0
0 1 1
0 0 1
AB A B If A then B
A A A is true
B B B is true
61
62
consequence antecedent
If x is A then y is B. AB
or or
conclusion premise
Examples
A B If x is A then y is B.
AB R
If x is A then y is B.
to interpret A B
A fuzzy rule can be defined
R x, y A B x, y
Depends on how
as a binary relation with MF
64
R x, y A B x, y ?
Interpretations of A B
B B
xx xx
A A 65
R x, y A B x, y ?
Interpretations of A B
B B
xx xx
A 66
R x, y A B x, y ?
Interpretations of A B
A entails B (not A or B)
A coupled with B A entails B
y
• Material implication
y
R A B A B
• Propositional calculus
R A B A ( A B)
B
• Extended propositional calculus
B
R A B (A B) B
• Generalization of modus ponens
x
A ( x) xB ( y )
xx
1
R ( x, y )
B ( yA
) otherwise A 67
R x, y A B x, y ?
Interpretations of A B
A entails B (not A or B)
• Material implication
R A B A B R ( x, y ) max 1 A ( x), B ( x)
• Propositional calculus
R A B A ( A B) R ( x, y ) max 1 A ( x), min A ( x), B ( x)
Rule: if x is A then y is B
Fact: x is A’
Conclusion: y is B’
69
Fuzzy Reasoning
Single Rule with Single Antecedent
Rule: if x is A then y is B
Fact: x is A’
Conclusion: y is B’
( x) ( y)
A A’ B
B’ = ?
70
x y
R ( x, y ) A ( x ) B ( y )
Fuzzy Reasoning
Single Rule with Single Antecedent
Max-Min Composition
Rule: if x is A then y is B
B ( y ) max x min A ( x), R ( x, y )
Fact: x is A’
x A ( x ) R ( x, y )
x A ( x) A ( x) B ( y )
Conclusion: y is B’
x A ( x) A ( x) B ( y )
Firing Strength
Firing
Firing
Strength
Strength
( x) ( y)
A A’ B
B 71
x y
R ( x, y ) A ( x ) B ( y )
Fuzzy Reasoning
Single Rule with Single Antecedent
Max-Min Composition
Rule: if x is A then y is B
B ( y ) max x min A ( x), R ( x, y )
Fact: x is A’
x A ( x ) R ( x, y )
x A ( x) A ( x) B ( y )
Conclusion: y is B’
x A ( x) A ( x) B ( y )
B A ( A B )
( x) ( y)
A A’ B
B 72
x y
Fuzzy Reasoning
Single Rule with Multiple Antecedents
Fact: x is A and y is B
Conclusion: z is C
73
Fuzzy Reasoning
Single Rule with Multiple Antecedents
Fact: x is A’ and y is B’
Conclusion: z is C’
( x) ( y) ( z)
A A’
B’ B C
C’ = ?
74
x y z
R A B C
Rule: if x is A and y is B then z is C
R ( x, y, z ) AB C ( x, y, z )
Fact:
Fuzzy Reasoning
x is A’ and y is B’
Conclusion: z is C’
Antecedents
Single Rule with Multiple ( x) ( y ) ( z ) A B C
Max-Min Composition
C ( y ) max x , y min A, B ( x, y ), R ( x, y, z )
x , y A , B ( x , y ) R ( x , y , z )
x , y A ( x) B ( y ) A ( x) B ( y) C ( z )
x A ( x) A ( x) y B ( y ) B ( y ) C ( z )
Firing Strength
( x) ( y) ( z)
A A’
B’ B C
C 75
x y z
R A B C
Rule: if x is A and y is B then z is C
R ( x, y, z ) AB C ( x, y, z )
Fact:
Fuzzy Reasoning
x is A’ and y is B’
Conclusion: z is C’
Antecedents
Single Rule with Multiple ( x) ( y ) ( z ) A B C
Max-Min Composition
C ( y ) max x , y min A, B ( x, y ), R ( x, y, z )
x , y A , B ( x , y ) R ( x , y , z )
C A (x) B( y) (x) A
x, y A B z) C
(
( y) B A B C
x A ( x) A ( x) y B ( y ) B ( y ) C ( z )
Firing Strength
( x) ( y) ( z)
A A’
B’ B C
C 76
x y z
Fuzzy Reasoning
Multiple Rules with Multiple Antecedents
77
Rule1: if x is A1 and y is B1 then z is C1
Rule2: if x is A2 and y is B2 then z is C2
Fact: x is A’ and y is B’
Conclusion: z is C’
Fuzzy Reasoning
Multiple Rules with Multiple Antecedents
( x) ( y) ( z) C1
A’ A1 B1 B’
x y z
( x) ( y) ( z)
A’ A2 B2 B’ C2
x y z
C’ = ?
78
Rule1: if x is A1 and y is B1 then z is C1
Rule2: if x is A2 and y is B2 then z is C2
Fact: x is A’ and y is B’
Conclusion: z is C’
Fuzzy Reasoning
Multiple Rules with Multiple Antecedents
Max-Min Composition
( x) ( y) ( z) C1
A’ A1 B1 B’
C1
x y z
( x) ( y) ( z)
A’ A2 B2 B’ C2
C2
x y z
Max
Max
C A B R1 R2
( z)
A B R1 A B R2 C C1 C2
C1 C2 79
z
80
81