M. Berthold, Uni Konstanz:Tutorial "Fuzzy Logic ... - VideoLectures
M. Berthold, Uni Konstanz:Tutorial "Fuzzy Logic ... - VideoLectures
M. Berthold, Uni Konstanz:Tutorial "Fuzzy Logic ... - VideoLectures
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
ALTANA Chair for<br />
Bioinformatics and Information Mining<br />
<strong>Tutorial</strong>: <strong>Fuzzy</strong> <strong>Logic</strong><br />
Advanced Course on Knowledge Discovery, Ljubljana, June 2005<br />
Michael R. <strong>Berthold</strong><br />
<strong>Konstanz</strong> <strong>Uni</strong>versity<br />
Michael.<strong>Berthold</strong>@uni-konstanz.de<br />
Overview<br />
• <strong>Fuzzy</strong> <strong>Logic</strong><br />
– Motivation<br />
– Degrees of Membership and <strong>Fuzzy</strong> Sets<br />
– Linguistic Values and Variables<br />
– Operators on <strong>Fuzzy</strong> Sets<br />
– <strong>Fuzzy</strong> Implication<br />
• <strong>Fuzzy</strong> Rules<br />
– Inference<br />
– Construction of <strong>Fuzzy</strong> Rules from Data<br />
• <strong>Fuzzy</strong> Arithmetic<br />
– <strong>Fuzzy</strong> Numbers<br />
– Operations on <strong>Fuzzy</strong> Numbers<br />
– Extension Principle<br />
• Conclusion<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #2<br />
• Modeling of imprecise concepts:<br />
– Age, Weight, Height, …<br />
<strong>Fuzzy</strong> <strong>Logic</strong>: Motivation<br />
• Modeling of imprecise dependencies (e.g. rules):<br />
– If Temperature is low and Oil is cheap then crank up the heating system<br />
• Origin of Information:<br />
– Modeling of Expert Knowledge<br />
– Representation of information extracted from inherently imprecise data<br />
Characteristic Functions: Crisp Sets<br />
• Classical Sets can be described by a characteristic function:<br />
⎧1<br />
m A ⎨<br />
⎩ 0<br />
• Example:<br />
x ∈ A<br />
x ∉ A<br />
( x)<br />
: =<br />
( x) ∈{ 0,1}<br />
m A<br />
(x)<br />
1<br />
{ x a ≤ x ≤ b}<br />
A = |<br />
m A<br />
a<br />
b<br />
x<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #3<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #4<br />
Characteristic Functions: <strong>Fuzzy</strong> Sets<br />
• <strong>Fuzzy</strong> Sets are described by a membership function:<br />
µ A<br />
• Example:<br />
( x) [ ]<br />
~ ∈ 0,1<br />
[ a b]<br />
A x is roughly in ,<br />
Linguistic Variables and Values<br />
• Associating meaning (semantic) with fuzzy sets results in<br />
– Linguistic Variables: the (labeled!) domain of the fuzzy sets<br />
– Linguistic Values: a (labeled!) collection of fuzzy sets on this domain<br />
• Examples:<br />
– Age: young, old<br />
µ young/old<br />
( x)<br />
µ<br />
young<br />
µ<br />
old<br />
1<br />
~ =<br />
a b<br />
( )<br />
1<br />
µ ~ A<br />
x<br />
– Size: small, medium, tall<br />
µ sml/med/ta ll(<br />
x)<br />
1<br />
30 50 x [years]<br />
µ<br />
µ µ<br />
small<br />
medium<br />
tall<br />
x<br />
150 190<br />
x [cm]<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #5<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #6<br />
M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong><br />
"<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. 1
• what about basketball players<br />
µ sml/med/ta ll(<br />
x)<br />
1<br />
Linguistic Values & Context<br />
µ<br />
small<br />
µ medium<br />
µ<br />
tall<br />
Types of Membership Functions<br />
Trapezoid: <br />
Gaussian: N(m,s)<br />
µ(x)<br />
µ(x)<br />
1<br />
1<br />
• …and jockeys<br />
µ sml/med/ta ll(<br />
x)<br />
1<br />
180 220<br />
µ<br />
small<br />
µ medium<br />
µ<br />
tall<br />
140 160<br />
⇒ linguistic values are inherently context dependent!<br />
x [cm]<br />
x [cm]<br />
0<br />
a b c d x<br />
Triangular: <br />
µ(x)<br />
1<br />
0<br />
a b d x<br />
s<br />
0<br />
m x<br />
Singleton: (a,1) and (b,0.5)<br />
µ(x)<br />
1<br />
0<br />
a b x<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #7<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #8<br />
<strong>Fuzzy</strong> Membership Function: Basic Concepts<br />
• Support: elements having non-zero degree of membership<br />
• Core: set with elements having degree of 1<br />
• α-Cut: set of elements with degree >= α<br />
• Height: maximum degree of membership<br />
1<br />
core<br />
Operators on <strong>Fuzzy</strong> Sets<br />
• Set of old and tall people (Conjunction)<br />
µ<br />
old<br />
( x)<br />
= 0.7<br />
µ ( x)<br />
0.5<br />
tall<br />
=<br />
µ<br />
old ∧ tall(<br />
x)<br />
= <br />
µ tall<br />
1<br />
µ<br />
old ∧ tall(<br />
x)<br />
= 0.2<br />
µ<br />
old ∧ tall(<br />
x)<br />
= 0<br />
µ<br />
old ∧ tall(<br />
x)<br />
= 0.7<br />
µ<br />
old ∧ tall(<br />
x)<br />
= 0.5<br />
µ<br />
old ∧ tall(<br />
x)<br />
= 1.0<br />
µ A<br />
0<br />
α<br />
α-cut<br />
height<br />
support<br />
x<br />
0<br />
0 1<br />
µ old<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #9<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #10<br />
Operators on <strong>Fuzzy</strong> Sets<br />
• Set of old or tall people (Disjunction)<br />
µ<br />
old<br />
( x)<br />
= 0.7<br />
µ ( x)<br />
0.5<br />
tall<br />
=<br />
µ<br />
old ∨ tall(<br />
x)<br />
= <br />
µ tall<br />
µ<br />
old ∨ tall(<br />
x)<br />
= 0.7<br />
µ<br />
old ∨ tall(<br />
x)<br />
= 1.0<br />
Min / Max-Norm<br />
• Classical <strong>Fuzzy</strong> Operators: Min/Max-Norm<br />
– Conjunction:<br />
– Disjunction:<br />
– Negation:<br />
{ µ ( x),<br />
( )}<br />
µ ( x) : = min x<br />
A ∧B<br />
A<br />
µ<br />
B<br />
{ µ ( x),<br />
( )}<br />
µ ( x) : = max x<br />
A ∨B<br />
A<br />
µ<br />
B<br />
µ ( x) : = 1−<br />
( x)<br />
¬ A<br />
µ<br />
A<br />
µ<br />
old ∨ tall(<br />
x)<br />
= 0.5<br />
µ<br />
old ∨ tall(<br />
x)<br />
= 0.2<br />
1<br />
1<br />
µ (x) A µ B<br />
(x)<br />
µ<br />
old ∨ tall(<br />
x)<br />
= 0<br />
0<br />
0 1<br />
µ old<br />
0<br />
x<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #11<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #12<br />
M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong><br />
"<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. 2
Product / Bounded-Sum<br />
• Classical <strong>Fuzzy</strong> Operators: Product / Bounded-Sum<br />
– Conjunction:<br />
– Disjunction:<br />
– Negation:<br />
µ ( x) : = µ ( x)<br />
⋅ ( x)<br />
A ∧B<br />
A<br />
µ<br />
B<br />
µ ( x) : = µ ( x)<br />
+ µ ( x)<br />
− µ ( x)<br />
⋅ ( x)<br />
A ∨B<br />
A B A<br />
µ<br />
B<br />
µ ( x) : = 1−<br />
( x)<br />
¬ A<br />
µ<br />
A<br />
Lukasiewicz Norm<br />
1<br />
µ (x) A µ B<br />
(x)<br />
0<br />
x<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #13<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #14<br />
T-norms and S-norms<br />
<strong>Fuzzy</strong> T- and S-Norms<br />
T-Norm<br />
S-Norm<br />
S(u,v) = 1 – T(1-u,1-v)<br />
T(u,v) = 1 – S(1-u,1-v)<br />
using De Morgans Law<br />
(A∧B =¬(¬A∨¬B))<br />
Min-Max<br />
T ( a, b) = min{ a,<br />
b}<br />
S ( a, b) = max{ a,<br />
b}<br />
min/max:<br />
max(u,v) = 1 – min(1-u,1-v)<br />
…= 1-1-min(-u,-v) = max(u,v)<br />
T( a,<br />
b) = a ⋅b<br />
S( a,<br />
b) = a + b − a ⋅b<br />
Product-Sum<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #15<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #16<br />
<strong>Fuzzy</strong> T- and S-Norms<br />
Operator - Spectrum<br />
T-Norm<br />
S-Norm<br />
Lukasiewicz<br />
Norm<br />
T( a, b) = max{ 0, a + b −1}<br />
S ( a,<br />
b) = min{ 1,<br />
a + b}<br />
T-norms<br />
S-norms<br />
(T-conorms)<br />
drastic<br />
product<br />
bounded<br />
product<br />
min<br />
max<br />
bounded<br />
sum<br />
drastic<br />
sum<br />
Drastic<br />
Product/Sum<br />
⎧a<br />
,if b = 1<br />
⎪<br />
T( a, b)<br />
= ⎨b<br />
,if a = 1<br />
⎪<br />
⎩0<br />
,else<br />
⎧a<br />
,if b = 0<br />
⎪<br />
S( a, b)<br />
= ⎨b<br />
,if a = 0<br />
⎪<br />
⎩1<br />
, else<br />
u if v=1<br />
drastic product : T(u,v)= { v if u=1<br />
0 otherwise<br />
u if v=0<br />
drastic sum : S(u,v)= v if u=0<br />
{ 1 otherwise<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #17<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #18<br />
M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong><br />
"<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. 3
• Interesting effects:<br />
– A ∧ ¬A = <br />
– A ∨ ¬A = <br />
0<br />
1<br />
1<br />
<strong>Fuzzy</strong> Norms: Issues…<br />
µ (x) A<br />
µ ¬A<br />
(x)<br />
µ A<br />
(x)<br />
µ (x) A ∧¬A µ<br />
A ∨¬A(x)<br />
x<br />
<strong>Fuzzy</strong> Implication<br />
• One possibility:<br />
– derive Implication via tautology „A→B = ¬A∨(A∧B)“ and min/max norm.<br />
{ ( x),min{ µ ( x),<br />
( )<br />
}<br />
µ ( x) : = max 1− µ<br />
x<br />
A →B<br />
A<br />
A<br />
µ<br />
B<br />
*v* ¬A A∧B<br />
0<br />
µ ¬A<br />
(x)<br />
x<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #19<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #20<br />
• Or vice versa:<br />
– start with Lukasiewicz-Implication:<br />
<strong>Fuzzy</strong> Implication<br />
and derive disjunction and conjunction using<br />
– A∨B = ¬A→B<br />
– A∧B = ¬ (¬A∨¬B)<br />
{ µ ( x)<br />
( )}<br />
µ ( x) : = min 1, + x<br />
µ<br />
A ∨B<br />
A<br />
µ<br />
B<br />
A∧B<br />
(<br />
= max<br />
x) : = 1−<br />
min{ 1,1 − µ<br />
A(<br />
x)<br />
+ 1−<br />
µ<br />
B<br />
( x)<br />
}<br />
{ 0, µ ( x)<br />
+ µ ( x)<br />
−1}<br />
A<br />
{ − µ ( x)<br />
( )}<br />
µ ( x) : = min 1,1 + x<br />
A →B<br />
A<br />
µ<br />
B<br />
B<br />
• Classic Modus Ponens<br />
A<br />
A → B<br />
B<br />
• Imprecise:<br />
Generalized Modus Ponens<br />
µ A'<br />
( x)<br />
A → B<br />
µ B'<br />
( y)<br />
Imprecise Reasoning<br />
¬A<br />
A → B<br />
<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #21<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #22<br />
Joint Constraint (support distribution)<br />
• Using the Min/Max Norm:<br />
Implication results in a constraint on (x,y)<br />
µ ( x,<br />
y)<br />
= min µ ( x),<br />
( y)<br />
⇒ Cartesian Product A×B:<br />
A × B<br />
{<br />
A<br />
µ<br />
B<br />
}<br />
µ y)<br />
= sup{ min{ µ ( x),<br />
µ ( x,<br />
y)<br />
}<br />
B '( A'<br />
A×<br />
B<br />
x<br />
Conditional Constraint (possibility distribution)<br />
• Alternatively (using Lukasiewicz Norm):<br />
Implication results in relation expressing possibilities:<br />
Poss(<br />
x,<br />
y)<br />
= min 1,1 − µ ( x)<br />
+ ( y)<br />
{<br />
A<br />
µ<br />
B<br />
}<br />
sup{ min{ µ ( x),1<br />
− µ ( x)<br />
( x)<br />
}<br />
µ<br />
'( y)<br />
=<br />
A'<br />
A<br />
+<br />
B<br />
µ<br />
B<br />
x<br />
y<br />
y<br />
y<br />
µ B'<br />
( y)<br />
A× B<br />
µ B<br />
µ A<br />
µ A'<br />
( x)<br />
µ B'<br />
( y)<br />
'<br />
A× B<br />
x µ B µ A<br />
µ A'<br />
( x)<br />
'<br />
x<br />
µ B'<br />
( y)<br />
A → B<br />
µ µ x<br />
B A<br />
µ A'<br />
( x)<br />
x<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #23<br />
x<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #24<br />
x<br />
M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong><br />
"<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. 4
Joint vs. Conditional Constraint<br />
• Joint Constraints:<br />
– express positive knowledge (facts are supported)<br />
• Conditional Constraints:<br />
– express negative knowledge (facts are excluded)<br />
<strong>Fuzzy</strong> Rules<br />
• Rule: IF THEN <br />
• <strong>Fuzzy</strong> Version 1: Mamdani Rules<br />
– Antecedent: Conjunction of fuzzy memberships<br />
– Consequent: <strong>Fuzzy</strong> Set<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #25<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #26<br />
Example: Mamdani Rule<br />
IF age IS young AND car-power IS high THEN risk IS high<br />
µ<br />
low medium high<br />
risk<br />
age<br />
old<br />
<strong>Fuzzy</strong> Rules<br />
• Rule: IF THEN <br />
• <strong>Fuzzy</strong> Version 1: Mamdani Rules<br />
– Antecedent: Conjunction of fuzzy memberships<br />
– Consequent: <strong>Fuzzy</strong> Set<br />
• <strong>Fuzzy</strong> Version 2: Takagi-Sugeno -(Kang)- Rules<br />
– Antecedent: Conjunction of fuzzy memberships<br />
– Consequent: (usually) real-valued functions of degree 0-2.<br />
normal<br />
young<br />
µ<br />
µ<br />
low medium high<br />
car-power<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #27<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #28<br />
Example: Takagi-Sugeno Rule<br />
IF age IS young AND car-power IS high<br />
THEN risk-factor = w0+w1*age+w2*car-power<br />
<strong>Fuzzy</strong> Rule System (Mamdani)<br />
R1: IF age IS young AND car-power IS high THEN risk IS high<br />
R2: IF age IS normal AND car-power IS medium THEN risk IS medium<br />
old<br />
age<br />
w1*age<br />
R1:<br />
µ<br />
young<br />
µ<br />
high<br />
µ<br />
high<br />
normal<br />
age<br />
car-power<br />
risk<br />
young<br />
µ<br />
w2*car-power<br />
risk-factor<br />
w0<br />
µ<br />
low medium high<br />
car-power<br />
R2:<br />
µ<br />
µ<br />
µ<br />
normal medium medium<br />
age<br />
car-power<br />
risk<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #29<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #30<br />
M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong><br />
"<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. 5
<strong>Fuzzy</strong> Rule Systems: Example 1<br />
• Step 1: Fuzzification of crisp inputs<br />
µ<br />
µ<br />
µ<br />
0.8<br />
R1: young normal old<br />
0.4<br />
low medium high<br />
low medium high<br />
<strong>Fuzzy</strong> Rule Systems: Example 1<br />
• Step 2a: Inference (e.g. via Min/Max-Norm)<br />
µ = 0.4 R1<br />
R1:<br />
µ<br />
µ<br />
young normal old low medium high<br />
low medium high<br />
µ<br />
µ<br />
age<br />
µ<br />
car-power<br />
µ<br />
risk<br />
µ<br />
age<br />
µ<br />
car-power<br />
µ = 0.3<br />
R2<br />
µ<br />
risk<br />
R2:<br />
0.3<br />
0.7<br />
young normal old<br />
age<br />
low medium high<br />
car-power<br />
low medium high<br />
risk<br />
R2:<br />
young normal old<br />
age<br />
low medium high<br />
car-power<br />
µ<br />
low medium high<br />
risk<br />
low medium high<br />
age<br />
car-power<br />
a<br />
b<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #31<br />
age<br />
car-power<br />
risk<br />
a<br />
b<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #32<br />
<strong>Fuzzy</strong> Rule Systems: Example 1<br />
• Step 2b: Inference (e.g. via Maximum-Norm)<br />
• Step 3: Defuzzification<br />
<strong>Fuzzy</strong> Rule Systems: Example 1<br />
µ<br />
µ<br />
µ<br />
µ<br />
µ<br />
µ<br />
R1:<br />
young normal old<br />
low medium high<br />
low medium high<br />
R1:<br />
young normal old<br />
low medium high<br />
low medium high<br />
µ<br />
age<br />
µ<br />
car-power<br />
µ<br />
risk<br />
µ<br />
age<br />
µ<br />
car-power<br />
µ<br />
risk<br />
R2:<br />
young normal old<br />
low medium high<br />
low medium high<br />
R2:<br />
young normal old<br />
low medium high<br />
low medium high<br />
age<br />
car-power<br />
µ<br />
risk<br />
age<br />
car-power<br />
µ<br />
risk<br />
low medium high<br />
low medium high<br />
age<br />
car-power<br />
risk<br />
a<br />
b<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #33<br />
age<br />
car-power<br />
risk<br />
a<br />
b<br />
c=<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #34<br />
Defuzzification: Center of Gravity<br />
• Center of Gravity:<br />
∫ y ⋅ µ<br />
risk<br />
( y)dy<br />
y =<br />
µ ( y)dy<br />
∫<br />
risk<br />
Defuzzification: Other Methods<br />
• An easier approximation (with some imprecision…):<br />
y<br />
r<br />
∑<br />
µ ⋅<br />
j<br />
s j<br />
j=<br />
1<br />
=<br />
r<br />
∑<br />
j=<br />
1<br />
µ<br />
j<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #35<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #36<br />
M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong><br />
"<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. 6
• <strong>Fuzzy</strong> Inference<br />
0.7<br />
<strong>Fuzzy</strong> Inference (Mamdani)<br />
Fuzzification Inference Defuzzification<br />
µ cold µ warm µ hot<br />
0.2<br />
Measurement<br />
t<br />
<strong>Fuzzy</strong> Rules<br />
if temp is cold<br />
then valve is open<br />
µ cold =0.7<br />
if temp is warm<br />
then valve is half<br />
µ warm =0.2<br />
if temp is hot<br />
then valve is close<br />
µ hot =0.0<br />
0.7<br />
0.2<br />
µ open µ half µ close<br />
Output<br />
v<br />
large<br />
medium<br />
small<br />
zero<br />
µ<br />
<strong>Fuzzy</strong> Rule System (Mamdani)<br />
y<br />
µ<br />
R1: if x is small then y is medium<br />
R2: if x is medium then y is large<br />
R3: if x is large then y is zero<br />
small medium large<br />
x<br />
x<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #37<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #38<br />
<strong>Fuzzy</strong> Rule System (Takagi Sugeno)<br />
R1: IF x IS small THEN y = x<br />
R2: IF x IS medium THEN y = 5<br />
R3: IF x IS large THEN y = 2*x-5<br />
y<br />
r<br />
∑<br />
µ ⋅ y<br />
Ri<br />
i=<br />
1<br />
=<br />
r<br />
∑<br />
i=<br />
1<br />
µ<br />
Ri<br />
( x)<br />
i<br />
r<br />
5<br />
y<br />
µ<br />
small medium large<br />
x<br />
• Wang&Mendel Algorithm<br />
large<br />
medium<br />
small<br />
zero<br />
µ<br />
Construction of <strong>Fuzzy</strong> Rule Systems<br />
y<br />
µ<br />
R1: if x is zero then y is medium<br />
R2: if x is small then y is medium<br />
R3: if x is medium then y is large<br />
R4: if x is large then y is medium<br />
x<br />
5<br />
x<br />
10<br />
zero small medium large<br />
x<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #39<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #40<br />
Grid Based Algorithms<br />
• Exponentially many rules in high dimensional spaces<br />
• If grid is chosen fine enough: arbitrarily good approximation<br />
possible (but at what cost!)<br />
• Wrong choice of grid: skipping of extrema<br />
• One extension: Higgins&Goodman Algorithm (see IDA-book)<br />
– pre-define threshold for desired approximation error<br />
– finds “best” partitioning (=grid)<br />
– Disadvantages:<br />
• concentrates on outliers<br />
• interpretation difficult: granulation solely data driven<br />
Free <strong>Fuzzy</strong> Rules<br />
• No global dependence on granulation:<br />
– individual (per rule) membership functions<br />
– better modeling of local properties<br />
• Not all attributes used for all rules:<br />
– individual choice of constraints on few attributes per rule<br />
– better interpretability in high dimensions<br />
– no exponential explosion of rules with dimensionality<br />
• Other Constructive Algorithms (coming up next…)<br />
– Local membership functions<br />
– partially predefined membership functions/granulations possible<br />
– somewhat tolerant against outliers through local caching<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #41<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #42<br />
M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong><br />
"<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. 7
Algorithm FRL<br />
Formation of Free <strong>Fuzzy</strong> Rules<br />
Algorithmus FRL<br />
Formation of Free <strong>Fuzzy</strong> Rules<br />
1. FORALL training examples (x,c) DO<br />
1. IF correct rule of class c exists:<br />
• COVERED:<br />
– increase weight +1<br />
– adjust core region of rule to cover x<br />
2. ELSE:<br />
• COMMIT:<br />
– insert new rule with core=x<br />
– Support = infinite (i.e. rule is not constrained)<br />
3. SHRINK:<br />
• Reduce Support of all Rules of conflicting class that cover x.<br />
2. Until no more changes occured.<br />
Steps:<br />
• COVERED: easy<br />
• COMMIT: easy.<br />
• SHRINK: heuristic<br />
one solution: volume-based.<br />
Demo.<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #43<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #44<br />
Formation of Free <strong>Fuzzy</strong> Rules<br />
Observations:<br />
• FRL finds set of rules completely describing the data<br />
(as long as training data is conflict free…)<br />
• Each rule is a partial hypothesis for a subset of training data<br />
– core: most specific hypothesis covering subset of training data<br />
– support: (one of the) most general hypotheses covering subset of data.<br />
– support is_more_general_than core.<br />
• Core and Support regions can also be seen as:<br />
– smallest area with highest degree of confidence (we have evidence)<br />
– largest area without conflict (we have not seen any counter-examples)<br />
Other Types of <strong>Fuzzy</strong> Rule Learning Methods<br />
• Constructive:<br />
– Finding fuzzy rules by growing from singletons<br />
(⇔ FRL shrinks from most general until it fits to data)<br />
• GRID:<br />
– merge grid cells (or rows/columns) if no points covered or same class<br />
predicted<br />
• Adaptive:<br />
– Initialize rules randomly (or via expert knowledge) and optimize rule<br />
parameters (location, sometime also number of membership functions)<br />
iteratively (gradient descent, heuristic hill climbing algorithms).<br />
• Neuro-<strong>Fuzzy</strong> (later…):<br />
– inject fuzzy rules into neural network and use NN training algorithms.<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #45<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #46<br />
<strong>Fuzzy</strong> Numbers: Motivation<br />
• Often it is desirable to preprocess imprecise inputs<br />
– add or multiply fuzzy numbers<br />
– apply function (normalization, …) to fuzzy numbers<br />
• <strong>Fuzzy</strong> Controller can be extended to process imprecise inputs<br />
via use of fuzzy numbers.<br />
<strong>Fuzzy</strong> Numbers<br />
• Classic (“crisp”) Numbers: a∈R<br />
– Characteristic Function m a (x)∈{0,1}<br />
m a<br />
• <strong>Fuzzy</strong> Numbers: Model Imprecision in e.g. measurement.<br />
• <strong>Fuzzy</strong> Number („about a“):<br />
– membership function µ a (x)∈[0,1] Membership functions<br />
of fuzzy numbers are<br />
µ (usually):<br />
a<br />
• normalized<br />
• monotone (left/right)<br />
• singular<br />
x<br />
x<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #47<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #48<br />
M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong><br />
"<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. 8
• Addition of two crisp Numbers:<br />
Operations on <strong>Fuzzy</strong> Numbers<br />
• Addition of two Singletons:<br />
Operations on <strong>Fuzzy</strong> Numbers<br />
1<br />
m a/b<br />
a b<br />
1<br />
µ a/b<br />
a b<br />
m<br />
+ b<br />
m<br />
a+b<br />
x<br />
⎧ 1 z = a + b<br />
( z)<br />
= ⎨<br />
⎩0<br />
else<br />
a<br />
( z)<br />
= max{ m ( x) ⋅ m ( y)<br />
x + y z}<br />
a + b<br />
a b<br />
| =<br />
x,<br />
y∈R<br />
= “and”...<br />
µ<br />
a+<br />
b<br />
a+b<br />
x<br />
{ µ ( a),<br />
µ ( b)<br />
}<br />
⎧ min<br />
a b<br />
z = a + b<br />
( z)<br />
= ⎨<br />
⎩ 0<br />
else<br />
{ min{ µ ( x) , µ ( y)<br />
} x + y z}<br />
µ<br />
a b<br />
( z)<br />
= max<br />
a b<br />
=<br />
+<br />
|<br />
x,<br />
y∈R<br />
= and<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #49<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #50<br />
• Addition of two (fuzzy) intervals:<br />
Operations on <strong>Fuzzy</strong> Numbers<br />
Operations on <strong>Fuzzy</strong> Numbers<br />
• And finally: Addition of two <strong>Fuzzy</strong> Numbers:<br />
1<br />
µ a/b<br />
a b<br />
1<br />
µ a/b<br />
a b<br />
a+b<br />
x<br />
x<br />
{ min{ µ ( x) , µ ( y)<br />
} x + y z}<br />
µ<br />
a b<br />
( z)<br />
= max<br />
a b<br />
=<br />
+<br />
|<br />
x,<br />
y∈R<br />
= and<br />
{ min{ µ ( x) , µ ( y)<br />
} x + y z}<br />
µ<br />
a b<br />
( z)<br />
= max<br />
a b<br />
=<br />
+<br />
|<br />
x,<br />
y∈R<br />
what about other operators, for example multiplication<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #51<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #52<br />
Operations on <strong>Fuzzy</strong> Numbers<br />
• Multiplication of two <strong>Fuzzy</strong> Numbers:<br />
1<br />
µ a/b<br />
a b<br />
{ min{ µ ( x) , ( y)<br />
} | x*<br />
y z}<br />
µ<br />
a b(<br />
z)<br />
= max<br />
a b<br />
=<br />
µ<br />
* x,<br />
y∈R<br />
x<br />
Operations on <strong>Fuzzy</strong> Numbers<br />
• Crisp Functions applied to <strong>Fuzzy</strong> Numbers:<br />
µ<br />
f ( a)<br />
( y)<br />
= max{ µ<br />
a<br />
( x) | y = f ( x)<br />
}<br />
x∈R<br />
y<br />
y = f (x)<br />
µ f(a) x<br />
µ a<br />
a x<br />
what about arbitrary functions<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #53<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #54<br />
M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong><br />
"<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. 9
Operations on <strong>Fuzzy</strong> Numbers<br />
• Crisp (non monotone) function applied to <strong>Fuzzy</strong> Numbers:<br />
µ<br />
f ( a)<br />
( y)<br />
= max{ µ<br />
a<br />
( x) | y = f ( x)<br />
}<br />
x∈R<br />
y<br />
y = f (x)<br />
µ f(a) x<br />
• Based on Extension Principle:<br />
µ<br />
Operations on <strong>Fuzzy</strong> Numbers<br />
( y) = { min{ µ ( x ),..., µ ( x )} | y = f ( x ,..., x )}<br />
f ( a)<br />
max<br />
a 1 a n<br />
x x R<br />
n<br />
1<br />
,...,<br />
1<br />
1 n∈<br />
• Computable in Practice:<br />
– via series of α-cuts<br />
– via polynomial representation of left and right side of fuzzy numbers<br />
(closed under addition and multiplication a.o.)<br />
– via granulation on variables (grid based)<br />
– …<br />
n<br />
µ a<br />
a x<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #55<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #56<br />
Imprecise Functions (<strong>Fuzzy</strong> Graphs)<br />
• Real-valued Function: infinite set of crisp points<br />
• <strong>Fuzzy</strong> Graph: finite set of imprecise points<br />
– IF x IS small THEN y IS medium<br />
– IF x IS medium THEN y IS small<br />
– IF x IS large THEN y IS large<br />
large<br />
medium<br />
small<br />
µ<br />
y<br />
µ<br />
small medium large<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #57<br />
x<br />
Imprecise Functions (<strong>Fuzzy</strong> Graphs)<br />
• Each fuzzy point describes an imprecise relation:<br />
r<br />
x , y IS A×<br />
( ) B<br />
• A fuzzy graph is a collection of fuzzy points:<br />
r<br />
x y IS A × B OR ... OR A × B<br />
( , )<br />
1 1<br />
r r<br />
• Reasoning using fuzzy graphs:<br />
r<br />
x IS A<br />
~ r<br />
f IS A × B<br />
y IS B<br />
U j = 1<br />
j<br />
j<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #58<br />
<strong>Fuzzy</strong> Graphs<br />
• Approximation through cylindrical ~<br />
extension:<br />
B = projy A× I ∩ f<br />
{( ) }<br />
<strong>Fuzzy</strong> Graphs<br />
• Learning of <strong>Fuzzy</strong> Graphs from Data: Demo<br />
– Influence of granulation of target variable<br />
– Influence of outliers: large number of fuzzy points<br />
⇒ avoidance via outlier model<br />
Y<br />
B<br />
1<br />
1<br />
A<br />
X<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #59<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #60<br />
M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong><br />
"<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. 10
Wrap-Up / Conclusions<br />
• <strong>Fuzzy</strong> Methods<br />
– model imprecise knowledge (fuzzy rules)<br />
– draw imprecise conclusions<br />
• Main Concepts:<br />
– <strong>Fuzzy</strong> Set and Degree of Membership<br />
– <strong>Fuzzy</strong> Set Operators<br />
– Extension Principle: allow to extend classical functions to fuzzy numbers<br />
• Algorithms (mostly heuristic) to<br />
– find fuzzy rules in data<br />
– build fuzzy approximators (fuzzy graphs/rule systems)<br />
• <strong>Fuzzy</strong> Controllers in wide spread use<br />
22/06/2005 M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong> "<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. #61<br />
M. <strong>Berthold</strong>, <strong>Uni</strong> <strong>Konstanz</strong>:<strong>Tutorial</strong><br />
"<strong>Fuzzy</strong> <strong>Logic</strong>", ACAI 2005. 11