Lecture 4&5
Lecture 4&5
▫ Extension principle
▫ Fuzzy relations
▫ Fuzzy if-then rules
▫ Compositional rule of inference
▫ Fuzzy reasoning
Whyy fuzzyy rules?
A is a fuzzy set on X :
A A ( x1 ) / x1 A ( x 2 ) / x 2 A ( x n ) / x n
▫ Let:
▫ and
▫ Upon applying the extension principle, We have :
An example with continuous universe
▫ Let:
▫ and
MAX
General definition
• Suppose f is a mapping from n-D product space
X1×…×Xn to a single universe Y such that f(x1,…,xn) = y
• There is a fuzzy set Ai in each Xi
• Each element in an input vector (x1,…,xxn) occurs
simultaneously, which implies AND operator
• The membership grade of fuzzy set B induced by the
mapping f should be the minimum of the membership
graded of fuzzy set Ai’s.
General definition
• The extension principle implies that fuzzy set B induced
by the mapping f is defined by
• Let:
A ( x ) 0.5 / 1 0.8 / 1
B ( x ) 0.3 / 1 1 / 0 0.7 / 1
• and:
f : X *X X, f ( x1, x 2) x1. x 2
• applying the extension principle (by applying the
product instead of min):
f ( A, B) 0.15 /1 0.5 / 0 0.35 / 1 0.24 / 1 0.8 / 0 0.56 /1
(0.35 0.24) / 1 (0.5 0.8) / 0 (0.15 0.56) /1
0.35
0 35 / 1 00.88 / 0 0.56
0 56 /1
Crisp Relations
• Crisp relation:
▫ A crisp relation represents the presence or absence of
association, interaction or interconnectedness between the
elements of two or more sets.
▫
Example:
p
It is
i better
b tt tto show
h th
the ffuzzy relation
l ti as a relation
l ti matrix:
t i
Fuzzy Relations
• Example. The relation y >> x can be defined as:
µ (y
(y-x)
x)
R
0 x y;
R ( x, y ) 1
x y.
1 100( y x) 2
y-x
x x
"x is A" AND "y is B" = "(x,y) is A B”
"x is A" OR "y is B" = "(x,y) is A Y X B"
x x
A
A
B B
y y
Fuzzy Relations
• For example:
0.3 0.2
0.3 0 0.6
R 0 1 R 1 R T
0.2 1 0.4
0.6 0.4
Fuzzy relation on a single set
dom ( R ) ( x1 ) 1.0
dom ( R ) ( x2 ) 0.4
dom ( R ) ( x3 ) 1.0
dom ( R ) ( x4 ) 1.0
dom ( R ) ( x5 ) 0.5
dom ( R ) ( x6 ) 0.2
More on fuzzy relations
R R ( x , z ) m ax
1 2
m in[[ R1 ( x , y ), R 2 ( y , z )]
y
[ R1 ( x , y ) R 2 ( y , z )]
y
• Properties:
• Associativity: R (S T ) ( R S ) T
• Monotonicity: S T (R S) (R T )
Max-Min Composition
• For example:
Max-Min Composition
• Max-product
Max product composition:
R R ( x, z ) max[ R ( x, y ). R ( y, z )]
1 2 1 2
y
[ R1 ( x, y ). R2 ( y, z )]
y
• In general, we have max-*
max composition:
R R ( x , z ) [ R ( x , y ) * R ( y , z )]
1 2 1 2
y
• Let
• and
Example
x y z
0.9
1 0.4 a
02
0.2
0.2
R R (2, a ) 0.7 (max-min composition) 2 b
1 2
0.5
R R (2, a ) 0.63 (max-product composition) 0.8
1 2
3
0.9 0.7
Linguistic Variables (detailed description)
Dilation: D IL ( A ) A 0 .5
• Composite
C it MF
MFs can b
be constructed
t t d as
Operations on Linguistic
g Values
Contrast intensification:
2A2 , 0 A (x) 0.5
INT ( A)
2(A)2
, 0.5 A (x) 1
Linguistic Variable Modifiers
µ (temperature)
cold
ld
1 not cold
cold
co d
somewhat
very cold cold
temperature
Linguistic Variable Modifiers
n ( x ); x A
n
• INTensify
y – µint((x)) =
1 n ( x ); x A
n
positively tall
1
tall
0.5
Linguistic
g Variable Modifiers
• AROUND, ABOUT, APPROXIMATE – Broaden µ(x).
( )
• BELOW, ABOVE – (see illustration below)
0.5 0.5
about tall
tall tall
Orthogonality
• A term set T = t1,…,tn for a linguistic variable x on the
universe X is orthogonal if:
If x is A then y is B
• Examples:
▫ If pressure is high, then volume is small.
▫ If the road is slippery, then driving is dangerous.
▫ If a tomato
t t is
i red,
d then
th it isi ripe.
i
▫ If the speed is high, then apply the brake a little.
If-Then
Fuzzy If Then Rules
B B
x x
A A
If-Then
Fuzzy If Then Rules
• Two ways to interpret “If x is A then y is B”:
▫ A coupled with B: (A and B)
~
R A B A B A( x)B( y)|( x, y)
▫ A entails B: (not A or B)
Material
ate a implication:
p cat o
Propositional calculus:
Extended propositional calculus:
Generalization of modus ponens:
where
If-Then
Fuzzy If Then Rules
• Although the four formulas are different, they all reduced to
the family identity A B == ̚ AUB when A and B are
propositions in the sense of two-valued (0 or 1) logic
• Based on various fuzzy T-norm and T-conorm (S-norm),
we may have the following for R = A B
• Larsen type
yp ((algebraic
g p
product):
)
• Bounded product:
• Drastic product:
If-Then
Fuzzy If Then Rules
• Fuzzy implication function:
R ( x , y ) f ( A ( x ),
) B ( y )) f ( a , b )
• A coupled with B
If-Then
Fuzzy If Then Rules (entails)
• Zadeh’s arithmetic rule:
• Boolean fuzzy
f implication:
A entails B
Fuzzyy reasoning
g
• p
Similar idea was used for max-min operation
• Suppose we have a curve y = f(x)
• When we are given x = a, then we can infer that y = b = f(a)
• A generalization
li i would ld b
be allowing
ll i a to b be an interval
i l and
d
f(x) to be an interval-values function
• We should first construct cylindrical extension of a and
then find its intersection I with the interval-values curve
• The projection of I onto the y-axis yields the interval y = b
Compositional Rule of Inference
b b
y = f(x)
f( ) y = f(x)
a x x
a
a and b: points a and b: intervals
y = f(x) : a curve y = f(x) : an interval-valued
function
Compositional Rule of Inference
• Then,
h
• a is a fuzzy
y set and y = f(x)
( ) is a fuzzy
y relation:
Fuzzyy reasoning
g
• Or equivalently
Fuzzyy Reasoning
g
• Single
g rule with single
g antecedent
Fact: x is A’
Rule: if x is A, then y is B
--------------------------------------------------
Conclusion: y is B’
• Graphic
G hi R Representation:
t ti
A’ A B
w
X Y
A’
B’
X Y
x is A’ y is B’
Fuzzyy Reasoning
g
• In this case, we have (assuming ˄ for the relation A B)
• Indeed
Indeed,
• first we find the degree of match w as the maximum of
μA’(x)˄μA(x)
• Then,, the MF of resulting
g B’ is equal
q to the MF of B clipped
pp
by w
• Note that w represents a measure of degree of belief for
the antecedent part of a rule
• This measure gets propagated by the ifif-then
then rules and the
resulting degree of belief of MS for the consequent part (B’)
should be no greater than w
Fuzzyy Reasoning
g
• Single rule with multiple antecedent
Fact: x is A’ and y is B’
Rule: if x is A and y is B, then z is C
---------------------------------------------------------
Conclusion: z is C’
• Graphic
p Representation:
p
A’ A B’ B T-norm C2
w
Z
X Y
A’ B’
C’
C
Z
x is A’ X y is B’ Y z is C’
Fuzzyy Reasoning
g
• Based on Mamdani’s rule:
• The resulting C’
C is expressed as
• Thus,
Fuzzyy Reasoning
g
• w1 and w2 are the maxima of the MFs of AՈA’ and BՈB’
• w1 denotes the degree of compatibility between A and A’
• w1 and w2 is called the firing strength or degree of
fulfillment of the fuzzy rule
Fuzzyy Reasoning
g
• Decomposition method for calculating C’
• Proof
Fuzzyy Reasoning
g
• Multiple
p rules with multiple
p antecedent
Fact: x is A’ and y is B’
Rule 1: if x is A1 and y is B1 then z is C1
Rule 2: if x is A2 and y is B2 then z is C2
-------------------------------------------------------
C
Conclusion:
l i z is
i C’
• Graphics
p p
representation:
A’ A1 B’ B1 C1
w1
Z
X Y
A’ A2 B’ B2 C2
w2
Z
X Y
T norm
T-norm
A’ B’
C’
Z
x is A’ X y is B’ Y z is C’
Four steps
p of fuzzy
y reasoning
g
• Degrees of compatibility:
▫ Compare the known facts with the antecedents of fuzzy
rule to find the degree of compatibility with respect to each
antecedent MF
• Firing strength:
▫ Combine degree of compatibility with respect to antecedent
MFs in a rule using g fuzzy
y AND or OR operators
p to form a
firing strength that indicates the degree to which the
antecedent part of the rule is satisfied
Four steps
p of fuzzy
y reasoning
g
• Qualified (induced) MFs:
▫ Apply the firing strength to the consequent MF of a rule to
generate a qualified consequent MF
• Overall output MF:
▫ Aggregate all the qualified consequent MFs to obtain an
overall output MF
Example
p
• Comparing crisp logic inference and fuzzy logic inference
Crisp
C i Ali is
i 22 years old
ld
logic Dina is 3 years older than Ali .
Dina is (22 + 3) years old
Translation –
Age(Ali) = 22; (Age(Dina),Age(Ali)) = Age(Dina)–Age(Ali) = 3;
Age(Dina) = Age(Ali) + 3 = 22 + 3 = 25
5 20 35 50 Age
Example
p
• Much_older is a relation which is defined as:
1 x y 20,
1
µmuch_older(x,y) = 20 ( x y) 0 x y 20,
0 x y.
µ (x,y)
much_older
40
30
20
x
10
40 y
30
20
10
0
Example
p
• For each fixed x, find
µAge(Dina)(x) = max(min(µyoung(y),µmuch_older(x,y)):
µ (x)
Age(Dana)
1.0
0.8
0.6
0.4
0.2
0
0 5 10 15 20 25 30 35 40 45
x
Example:
p control
Example:
p fuzzy
y control
Example:
p fuzzy
y control
Crisp
Crisp Inference Defuzzilier Values
Values Fuzzifier
Engine
Membership Functions
For example, Mamdani rule (we will see in the next chapter !):
Fuzzy
X (real number) Value Fuzzy AND/OR DOF
Fuzzifier Values
C
Connectives
ti
Membership
Functions
Method of
Defuzzification
Y Y1
Fuzzy Y2
Output (Fuzzy set) Defuzzifier Defuzzified
Value output
Bl k
Block
Yn (real number)
Example: fuzzy control
IF theta is POS
ZERO
AND theta_dot is POS NEG POS
theta Fuzzifier
((POS)) Output Center of Gravity
Block force
theta_dot Fuzzifier
AND (NEG)
(NEG) D f
Defuzzifier
ifi
Output
Rule #2 force
Rule #3 force
Example:
p Robot obstacle avoidance
Angle of sensor i w
Distance to obstacle v
(
(measureddbby sensor i)
Fuzzy-Logic-Controller
1
2
Example:
p Robot obstacle avoidance
Membership Functions:
Close Near Far Neg Zero Pos
e
e
CONTROLLER
de/dt
U
I e VL sin e HL cos e
w V mg mL ( e sin e e 2 cos e )
H mw mL
L ( e cos e e 2 sin
i e)
This can be hard.
U H Mw
Defining
g the Linguistic
g Variables
NL NM NS AZ PS PM PL
A( )
A(x) Chosen based on A( )
A(x)
uncertainty in
measurement
x x
No fuzzification
Inference Rules
e
NM NS AZ PS PM
NS NS AZ IInterior
i
de/dt values
AZ NM AZ PM U
PS AZ PS
• These seven rules handle many cases.
• “If angle is PS and rate of change is NS, then
drive applied to vehicle is AZ.”
Mamdani Inference (will see soon!)
Rule 1
Rule 2
A’
Given Fact Conclusion
Mamdani Inference
Rule 1
Rule 2
• JJ-S
S R Jang and C T Sun,
C-T Sun Neuro Fuzzy
Neuro-Fuzzy
and Soft Computing, Prentice Hall, 1997
(Chapter 3)
3).