03 FL Fuzzy Rules
03 FL Fuzzy Rules
Soft Computing 1 / 65
Concept of fuzzy system
Fuzzy
element(s)
Fuzzy set(s)
I
N Fuzzy rule(s)
P
Fuzzy
implication(s)
U (Inferences) O
T U
Fuzzy system
T
Soft Computing T 2 / 65
Fuzzy Relations
Soft Computing 3 / 65
Crisp relations
Note :
(1) A × B ≠ B × A
(2) |A × B| = |A| × |B|
(3)A × B provides a mapping from a ∈ A to b ∈ B.
Soft Computing 4 / 65
Crisp relations
Example 1:
Consider the two crisp sets A and B as given below. A ={ 1,
2, 3, 4}
B = {3, 5, 7 }.
Then, A × B = {(1, 3), (1, 5), (1, 7), (2, 3), (2, 5), (2, 7),
(3, 3),
7), (3,
(4, 5),
3), (4, 5), (4, 7)}
Let us define a relation R as R = {(a, b)|b = a + 1, (a, b) ∈
A × B}
Then, R = { (2, 3), (4, 5)} in this case.
We can represent the relation R in a matrix form as
3 5
follows.
7
1 0 0 0
R
2
1 0
0 0
3 0
=
0
4 0 1
0
Soft Computing 5 / 65
Operations on crisp relations
Intersection:
Complement:
R(x, y ) = 1 − R(x, y )
Soft Computing 6 / 65
Example: Operations on crisp relations
Example:
Suppose, R(x, y ) and S(x, y ) are the two relations define
over two crisp sets x ∈ A and y ∈ B
0 1 0 0
0 1 0
0 0 1 0
R = and S 0 1 0 ;
0 0 0 0 1
=
1
0 0 0 0 0 0
0 0 1
Find the
following:
1 R ∪
2 S
R∩
3 S
R
Soft Computing 7 / 65
Composition of two crisp relations
Max-Min Composition
Given the two relation matrices R and S, the max-min
composition is defined as T = R ◦ S ;
Soft Computing 8 / 65
Composition: Composition
Example:
Given
X = {1, 3, 5}; Y = {1, 3, 5}; R = {(x, y )|y = x + 2}; S =
{(x, y R
Here, )|xand
< yS}is on X ×
Y . Thus, we have
R = { (1, 3), (3,
5)}
S = { (1, 3), (1, 5),
(3, 5)}
1
1 3 5
1 0 1 0 3 1
R= 3 0 0 and
1 5 0 0 S= 5
0
1 0 1
3 0 10
Using max-min composition R 1
◦ S= 5 0 0
Soft Computing
0 9 / 65
Fuzzy relations
Fuzzy relation is a fuzzy set defined on the Cartesian
product of crisp set X1, X2, ..., Xn
Here, n-tuples (x1, x2, ..., xn) may have varying
degree of memberships within the relationship.
The membership values indicate the strength of the
relation between the tuples.
Example:
X = { typhoid, viral, cold } and Y = { running nose,
high temp,
shivering }
The fuzzy relation R is
defined as
runningnose hightemperature shivering
typhoid 0. 0. 0.8
viral 1 9 0.7
cold 0. 0. 0.6
2 9
Soft Computing 10 /
Fuzzy Cartesian product
Suppose
A is a fuzzy set on the universe of discourse X with
µA(x )|x ∈ X
B is a Rfuzzy
Then =A× setB on
⊂X the
× universe
Y ; whereofRdiscourse Y with µB
has its membership
(y )|y
function∈ Y
by µR (x, given
y ) = µA×B (x, y ) = min{ µA (x ), µB (y )}
Example :
A = {(a 1 , 0.2), (a2, 0.7), (a3, 0.4)}and B = {(b 1 , 0.5),
(b2, 0.6)}
a1 0.2
b1 0.2
b2
R=A×B= a2 0.5
0.6 a3 0.4
0.4
Soft Computing 11 /
Operations on Fuzzy relations
Let R and S be two fuzzy relations on A × B.
Union:
Intersection:
Complement:
µR (a, b) = 1 − µR (a, b)
Composition
T =R◦S
µR◦S = maxy ∈Y { min(µR (x, y ), µS (y,
z))}
Soft Computing 12 /
Operations on Fuzzy relations: Examples
Example:
X = (x1, x2, x3); Y = (y1, y2); Z = (z1,
z2, z3);
y1 y2
R= x2 .2
0 x
x1 3
0.5
0.8 0.1
0.9 0.6
z1
1 .
S y2 z26
= 0.5 z1 z2 z3
z3
0.4 0.5
y 0x1 0.40.5 0.7
R◦S=
x2.5 0.8 0.9
0.8 0.9
0 x3 0.6 0.6 0.7
µR◦S (x1 , y1 ) = max { min(x1 , y1 ), min(y1 , z1 ), min(x1 , y2 ), min(y2 ,
z1 )}
= max {min(0.5, 0.6), min(0.1, 0.5)} = max {0.5, 0.1} = 0.5 13 /
Soft Computing
Fuzzy relation : An example
Let, R be a relation
P1 0.6 on0.6
P × 0.9
D, representing
0.8 which plant is
susceptible Pto
0.1
2 which 0.2 0.9
diseases, then
R can be stated as
R P
0.8
3 .9 0.3 0.4
= 04
P 0.8 0.8 0.4
0.9
0.2
Soft Computing 14 /
Fuzzy relation : An example
Soft Computing 17 /
2D Membership functions : Binary fuzzy relations
(x, y)
Soft Computing 18 /
2D membership function : An example
Hint:
You have given two relations R1 and R2.
Then, the required can be derived using the union
operation of R1
and R2
Soft Computing 20 /
Fuzzy Propositions
Soft Computing 21 /
Two-valued logic vs. Multi-valued logic
Soft Computing 22 /
Two-valued logic vs. Multi-valued logic
a b ∧ ∨ ¬a =⇒ =
0 0 0 0 1 1 1
1 1 1
0 2 0 2 1 1 2
0 1 0 1 1 1 0
1 1 1 1 1
2 0 0 2 2 2 2
1 1 1 1 1 1
2 2 2 2 2 2 1
1 1 1 1
2 1 2 1 2 1 2
1 0 0 1 1 0 0
1 1 1 1
1 2 2 1 1 2 2
1 1 1 1 1 1 1
Soft Computing 23 /
Three-valued logic
Soft Computing 24 /
Fuzzy proposition
Example 1:
P : Ram is
honest
1 T(P) = : Absolutely false
0.0
2 : Partially false
T(P) =
3
0.2 : May be false or not
false
4
T(P) =
0.4 : May be true or not
5
true
6 T(P) =
0.6 : Partially true
Soft Computing 26 /
Fuzzy proposition vs. Crisp proposition
Soft Computing 27 /
Canonical representation of Fuzzy proposition
Suppose, X is a universe of discourse of five
persons. Intelligent of x ∈ X is a fuzzy set as
defined below.
P : x is intelligent
The canonical form of fuzzy proposition of this
type, P is expressed by the sentence P : v is F .
Predicate in terms of fuzzy set.
P : v is F ; where v is an element that takes values v from
some universal set V and F is a fuzzy set on V that
represents a fuzzy predicate.
In other words, given, a particular element v , this
Soft Computing 28 /
Graphical interpretation of fuzzy proposition
F ( )v
P: v is F
T(P)
T(P) = µF(v) for a v ε V
v V
Soft Computing 29 /
Fuzzy Implications
Soft Computing 30 /
Fuzzy rule
If x is A then y is B
Soft Computing 31 /
Fuzzy implication : Example 1
traffic is High
Soft Computing 32 /
Fuzzy implication : Example 2
THIGH =
{(20, 0.2), (25, 0.4), (30, 0.6), (35, 0.6), (40, 0.7), (45,
0.8), (50, 0.8)}
R : THIGH → PLOW
1 2
3
4
where, R 20 .0.2 0.2 0.2
= 0.2 6
25 0.4 0.4 0.4
0.4
30 0.6 0.6 0.6
Note : If temperature is 40 then what about low
0.4
pressure?
35 0 0.6 0.6
0.4
Soft Computing 34 /
Interpretation of fuzzy rules
A entails B
Soft Computing 35 /
Interpretation as A coupled with B
∫
R:A→ B=A×B X µA (x ) ∗ µB (y )|( x ,y ) ; where ∗ is
=
T-norm operator. ×Y called a
T-norm operator
The most frequently used T-norm
operators are: Minimum : Tmin (a, b) =
min(a, b) = a ∧ b Algebric product : Tap (a,
b) = ab
Bounded product : Tbp (a, ab)if= 0b∨=(a + b −
Drastic product : T = 1b if a=
1) dp
1 0 if a, b <
1
Here, a = µA(x ) and b = µB (y ). T∗ is called the function of T-norm
operator.
Soft Computing 36 /
Interpretation as A coupled with B
Soft Computing 37 /
Interpretation as A coupled with B
Min operator: ∫
Rm = A × B X µA(x ) ∧ µB (y (x,y
)| ) or min(a, b) = a ∧
= ×Y f [Mamdanib rule]
Soft Computing 38 /
Product Operators
1)
Drastic product ∫ operator
Rdp = A × B X µA µB
= ×Y (x )ˆ• (y )|
(x,y )
a if b=
or fdp (a, b) = 1b if a=
1 0 if otherwise
Soft Computing 39 /
Interpretation of A entails B
R : A → B = A¯ ∪ B
Propositional calculus :
R : A → B = A¯ ∪ (A ∩ B)
R : A → B = (A¯ ∩ B¯ ) ∪ B
Soft Computing 40 /
Interpretation of A entails B
fza (a, b) = 1 ∧ (1 − a +
b)
Zadeh’s ∫ :
Rmm =¯Amax-min rule
∪ (A ∩ B) X (1 − µA (x )) (µA (x ) ∧
B (y ))|
=
or ×Y ∨ µ
(x,y )
fmm (a, b) = (1 − a) ∨(a ∧
b)
Soft Computing 41 /
Interpretation of A entails B
fbf (a, b) = (1 − a) ∨
b;
Soft Computing 42 /
Example 3: Zadeh’s Max-Min rule
Rmm = (A × B) ∪ (A¯ × Y )
Soft Computing 44 /
Example 3: Zadeh’s min-max rule:
Therefor
e, 1 2 3
4
a
1 1 1 1
0.2 0.8 0.8
Rmm = (A × B) ∪ (A¯ × Y c b
)= 0.4
d 0.2
0.2 0.6 0.6 0.4
1.0 0.8 0
Soft Computing 45 /
Example 3 :
X = { a, b, c, d }
Y = { 1, 2, 3, 4}
Let, A = { (a, 0.0), (b, 0.8), (c, 0.6),
(d, 1.0)}
B = { (1, 0.2), (2, 1.0), (3, 0.8), (4,
0.0)}
Determine the implication relation :
1 2
If x is A then y is B 3
a
4 0
Here, A × B 0 0
c
= 0.2 0
d
b
0.2 0.2 0.8 0.8
0
0.6 0.6 0
Soft Computing 46 /
Example 3 :
1 2 4
3
a 1
1 1 1 0.2
and A¯ × Y c b 0.2 0.2 0.4
= 0.4 0.2 0
0.4 0.4 1 2 3 4
d 0 0 0
a 1 1 1 1
b
0.2 0. 0.8 0.2
Rmm = (A × B) ∪ (A¯ × Y c 8
)= 0.4 0. 0.6 0.4
d 6
This R represents If x is A then y is 0.2 1. 0.8 0
B 0
Soft Computing 47 /
Example 3 :
IF x is A THEN y is B ELSE y is
C. The relation R is equivalent
to
R = (A ×
B) ∪ (A¯
× C)
X = { a, b, c, d }
Y = { 1, 2, 3, 4}
A = { (a, 0.0), (b, 0.8), (c, 0.6),
(d, 1.0)}
B = { (1, 0.2), (2, 1.0), (3, 0.8),
(4, 0.0)}
C = { (1, 0), (2, 0.4), (3, 1.0), (4,
0.8)}
1 2
Determine the implication 3
a
relation : 4 0
Here,
If × B y is B elsec y is 0C
A then
x is A
0
= 0.2 0
d
0.2b 0.2 0.8 0.8
0
0.6 0.6 0
Soft Computing 49 /
Example 4:
1 2 3 4
b 0 0.2 0.2 0.2
and A¯ × C c 0 0.4 0.4
= 0.4
d 0 0 0
0
a
R 1 2 3
4
c
= 0.2
d
0 0.4 1.0 0.8
0.2b 0.2 0.8 0.8
0.2
0.6 0.6 0.4
1.0 0.8 0
Soft Computing 50 /
Interpretation of fuzzy implication
If x is A then y is B
{
If x is A then y is B else y
is C
{ {
Soft Computing 51 /
Fuzzy Inferences
Soft Computing 52 /
Fuzzy inferences
1 Modus Ponens : P, P =⇒ ⇔Q
Q,
2 ⇔, ¬P
Modus Tollens : P =⇒ Q,
3
¬Q ⇔, P =⇒
R
Chain rule : P =⇒ Q, Q
=⇒ R
Soft Computing 53 /
An example from propositional logic
Give
n
1 C ∨ D
2 ∼ H =⇒ (A∧ ∼ B)
3 C ∨ D =⇒∼ H
4 (A∧ ∼ B) =⇒ (R ∨
S)
From the above can we infer R ∨ S?
Soft Computing 54 /
Inferring procedures in Fuzzy logic
Two important inferring procedures are used in fuzzy
systems :
Generalized Modus
Tollens (GMT)
If x is A Then y is
′
B y is B
— — — — — —
Soft Computing 55 /
Fuzzy inferring procedures
′ ′
Here, A, B, A and B are fuzzy sets.
′ ′
To compute the membership function A and B the
′
max-min composition of fuzzy sets B and A
′
,respectively with R(x, y ) (which is the known
implication relation) is to be used.
Thus,
′ ′
B = A ◦ R(x, µB (y ) = max [min(µA′ (x ), µR (x,
y) y ))]
′ ′
A = B ◦ R(x, y µA (x ) = max [min(µB ′ (y ), µR (x,
)
y ))]
Soft Computing 56 /
Generalized Modus Ponens
Generalized Modus Ponens (GMP)
P : If x is A then y is B
If x is A Then y is
′
B x is A
——————
——————
–
′
y is B
We are to
x
y1B ′ y2
find y1 y2
′ 1 1
= A ◦ R(x, y ) .5 0.4 0.5
A × B = 02 1 0.4 and A × Y = 2 0
x
where
x
R(x, y ) =
0.5
x 0.6 0.4
x x3
max {A ×3 B, A × 0
Y} 0.4
Note: For A × B, µA×B (x, y ) = min(µA x, µB 0.4
(y ))
Soft Computing 58 /
Example: Generalized Modus Ponens
y1 y2
x
1
.5 0.5
R(x, y ) = (A × B) ∪ (A × y )02 1
= x x3 0.4 0.4
0.6
′
Now, A = { (x1 , 0.6), (x2 , 0.9), (x3 ,
0.7)} ′ ′
Therefore, B = A ◦ R(x,
y) = 0.5
0.6 0.9 0.7 ◦0.5 1 0.4 = 0.9
0.5 0.6 0.4
′ ′
Thus we derive that y is B where B = {(y 1 , 0.9), (y2,
0.5)}
Soft Computing 59 /
Example: Generalized Modus Tollens
P: If x is A Then y is B
′
Q: y is B
— — — — — — — — — — —
— — —
′
x is A
Soft Computing 60 /
Example: Generalized Modus Tollens
′
From the above, we are to conclude that x is A . That is,
′
we are to determine A
Soft Computing 61 /
Example: Generalized Modus Tollens
0.6 0.4
′
Hence, we calculate that x is A
where
′
A = [(x1 , 0.5), (x2 , 0.9), (x3 , 0.6)]
Soft Computing 62 /
Practice
Given that :
Let,
R = (H × S) ∪ (H ×
2
Y)
Soft Computing 65 /