02 FL Introduction
02 FL Introduction
1 / 69
What is Fuzzy logic?
2 / 69
A brief history of Fuzzy Logic
He is fondly nick-named as
LAZ
Soft Computing 3 / 69
A brief history of Fuzzy logic
Soft Computing 4 / 69
Example : Fuzzy logic vs. Crisp logic
Yes or
Crisp answer No
True or
False
Milk Yes
Wate
A
Crisp
liquid
r
No
Coca
Is the
Spite liquid
colorless
?
Soft Computing 5 / 69
Example : Fuzzy logic vs. Crisp logic
May be
May not be
Partially
etc
Soft Computing 6 / 69
Example : Fuzzy logic vs. Crisp logic
Score
99
Extremely
Ankit honest
Rajesh
Very 75
Santosh honest
Fuzzy
Kabita 55
Honest at
times
Salmon
Extremely 35
Is the person dishonest
honest?
Soft Computing 7 / 69
World is fuzzy!
Soft Computing 8 / 69
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 9 / 69
Concept of fuzzy set
To understand the concept of fuzzy set it is better, if we first
clear our idea of crisp set.
X = The entire population of India.
H = All Hindu population = { h1, h2, h3, ... , hL }
M = All Muslim population = { m1, m2, m3, ... , mN }
Universe of X
discourse
H
M
Soft Computing 10 /
Example of fuzzy set
Soft Computing 11 /
Fuzzy set vs. Crisp set
Example:
H = { (h1, 1), (h2, 1), ... , (hL, 1) }
Person = { (p1 , 1), (p2 , 0), ... , (pN , 1) }
In case of a crisp set, the elements are with extreme values
of degree of membership namely either 1 or 0.
1 EX = Marks ≥ 90
2 A = 80 ≤ Marks <
3 90 B = 70 ≤
4 Marks < 80 C =
5 60 ≤ Marks < 70
6 D = 50 ≤ Marks <
7 60 P = 35 ≤
Marks < 50 F =
Marks < 35
Soft Computing 14 /
Example: Course evaluation in a crisp way
F P D C B A EX
1
0
3 5 6 7 80 90
5 0 0 0 100
Soft Computing 15 /
Example: Course evaluation in a fuzzy way
F P D C B A EX
1
0
3 5 6 7 80 90
5 0 0 0 100
Soft Computing 16 /
Few examples of fuzzy set
High Temperature
Low Pressure
Color of Apple
Sweetness of
Orange Weight of
Mango
Note: Degree of
membership
values lie in the
range [0...1].
Soft Computing 17 /
Some basic terminologies and notations
Note:
µA(x) map each element of X onto a membership
grade (or membership value) between 0 and 1
(both inclusive).
Question:
How (and who) decides µA(x) for a Fuzzy set A in X ?
Soft Computing 18 /
Some basic terminologies and notations
Example:
X = All cities in
India A = City of
comfort
A={(New Delhi,
0.7), (Bangalore,
0.9), (Chennai,
0.8), (Hyderabad,
0.6), (Kolkata,
0.3), (Kharagpur,
0)} Soft Computing 19 /
Membership function with discrete membership
values
Soft Computing 20 /
Membership function with discrete membership
values
A ={(0,0.1),(1,0.30),(2,0.78)……(10,0.1)}
1.0
0.8
0.6 Note : X = discrete
µ
value
0.4
0.2
How you measure happiness ??
0 2 4 6 8 10
A = “Happy family”
Soft Computing 21 /
Membership function with continuous
membership values
1.0
0.8
B (x) 1
4
0.6
x 50
1
10
0.4
0.2
0 50 10
0 B
Age (X)
Note : x = real value
B = “Middle aged” = R+
Soft Computing 22 /
Fuzzy terminologies: Support
Soft Computing 23 /
Fuzzy terminologies: Core
1.0
µ
0.5
Soft Computing 24 /
Fuzzy terminologies: Normality
1.0
Soft Computing 25 /
Fuzzy terminologies: Crossover points
Soft Computing 26 /
Fuzzy terminologies: Fuzzy Singleton
Soft Computing 27 /
Fuzzy terminologies: α-cut and strong α-cut
Aα = { x | µA (x) ≥ α }
Aα ’ = { x | µA (x) > α }
Soft Computing 28 /
Fuzzy terminologies: Convexity
Convexity : A fuzzy set A is convex if and only if for any x1 and
x2 ∈ X
and any λ ∈ [0, 1]
Note :
• A is convex if all its α- level sets are convex.
• Convexity (Aα ) =⇒ Aα is composedNon-convex
Membership
of a single line
segment only.
function is
convex
Membership
function
1. 1.
0 0
Soft Computing 29 /
Fuzzy terminologies: Bandwidth
Bandwidth :
For a normal and convex fuzzy set, the bandwidth (or width)
is defined as the distance the two unique crossover points:
Bandwidth(A) = | x1 - x2 |
where µA(x1) = µA(x2) = 0.5
Soft Computing 30 /
Fuzzy terminologies: Symmetry
Symmetry :
Soft Computing 31 /
Fuzzy terminologies: Open and Closed
A fuzzy set A is
Open left
If limx →−∞ µA (x) = 1 and limx → +∞ µA (x)
=0
Open right:
If limx →−∞ µA (x) = 0 and limx → +∞ µA (x) =
1
Closed
If : limx →−∞ µAOpen
(x)left
= limx → +∞ µA (x) = 0 Open right
Closed
Soft Computing 32 /
Fuzzy vs. Probability
Soft Computing 33 /
Prediction vs. Forecasting
Soft Computing 34 /
Fuzzy Membership
Functions
Soft Computing 35 /
Fuzzy membership functions
A fuzzy set is completely characterized by its membership
function (sometimes abbreviated as MF and denoted as µ
). So, it would be important to learn how a membership
function can be expressed (mathematically or otherwise).
Note: A membership function can be on
(a) a discrete universe of discourse and
(b)a continuous universe of discourse.
Example:
1.0 1.0
0.8 0.8
0.6 0.6
µA
µB
0.4 0.4
0.2 0.2
0 10 20 30 40 50
0 2 4 6 8 10
60
Soft Computing 36 /
Fuzzy membership functions
So, membership function on a discrete universe of course
is trivial. However, a membership function on a
continuous universe of discourse needs a special
attention.
Following figures shows a typical examples of
membership functions.
µ
µ
x x x
x x
Soft Computing 37 /
Fuzzy MFs : Formulation and parameterization
In the following, we try to parameterize the different
MFs on a continuous universe of discourse.
Triangular MFs : A triangular MF is specified by three
parameters
{ a, b, c} and can be formulated as follows.
0 if x ≤ a
x −a
triangle (x ;a ,b ,c ) b−a if a ≤ x ≤ b (1
c−x
= c−b if b ≤ x ≤ c )
0 if c ≤ x
1.0
a b c
Soft Computing 38 /
Fuzzy MFs: Trapezoidal
A trapezoidal MF is specified by four parameters {a, b, c,
d } and can be defined as follows:
1 if x ≤ a
x −a if a ≤ x
≤b
b−a
trapeziod (x ; a, b, c, (2
2d if b ≤ x ≤ c
d) = )
d −c if c ≤ x ≤ d
−x
0 if d ≤ x
1.0
a b c d
Soft Computing 39 /
Fuzzy MFs: Gaussian
c
0.
0.1 0.9
1 c c
Soft Computing 40 /
Fuzzy MFs: Generalized bell
bell(x; a, b, c)= 1
1+| x −a c |
2b
b
Slope at x
= 2a
Slope at y = b
x b y
2a
c- c c+
a a
Soft Computing 41 /
Example: Generalized bell MFs
1
Example: 1+ 2
;
µ(x)=
a = b = 1 and cx =
0;
1.0
-1 0 1
Soft Computing 42 /
Generalized bell MFs: Different shapes
Changing Changing
a b
Changing
a Changing a and
b
Soft Computing 43 /
Fuzzy MFs: Sigmoidal MFs
1.
0
Slope =
0.
a 5
Soft Computing 44 /
Fuzzy MFs : Example
Excellent = Marks ≤ 90
Very good = 75 ≤ Marks
≤ 90 Good = 60 ≤ Marks
≤ 75 Average = 50 ≤
Marks ≤ 60 Poor = 35 ≤
Marks ≤ 50 Bad= Marks
≤ 35
Soft Computing 45 /
Grading System
1
.8
.6
.4
.2
0
1 2 3 6
40 70 80 90
0 0 0 0
50
marks
You can decide a standard fuzzy MF for each of the fuzzy
garde.
Soft Computing 46 /
Operations on Fuzzy Sets
Soft Computing 47 /
Basic fuzzy set operations: Union
Union (A ∪ B):
µA∪B (x ) = max{ µA (x ), µB
(x )}
Example:
A = {(x 1 , 0.5), (x2, 0.1), (x3, 0.4)} and
B = {(x 1 , 0.2), (x2, 0.3), (x3, 0.5)};
C = A ∪ B = { (x1 , 0.5), (x2 , 0.3), (x3 , 0.5)}
µB µB
µ µA
µAUB
µA
x b q c x b q c
a p a p
Soft Computing 48 /
Basic fuzzy set operations: Intersection
Intersection (A ∩ B):
µA∩B (x ) = min{ µA (x ), µB
(x )}
Example:
A = {(x 1 , 0.5), (x2, 0.1), (x3, 0.4)} and
B = {(x 1 , 0.2), (x2, 0.3), (x3, 0.5)};
C = A ∩ B = { (x1 , 0.2), (x2 , 0.1), (x3 , 0.4)}
µA
µAᴖB
µB
µ
x b q c p b q c
a p a
x
Soft Computing 49 /
Basic fuzzy set operations: Complement
Complement (AC ):
µAAC (x ) = 1-µA (x
)
Example:
A = {(x 1 , 0.5), (x2, 0.1), (x3, 0.4)}
C = AC = {(x
µA 1 , 0.5), (x2, 0.9), (x3, 0.6)}
1.0
µA
µA’
µ
p x q p x q
Soft Computing 50 /
Basic fuzzy set operations: Products
µA•B (x ) = µA (x ) • µB
(x )
µα A (x ) = α · µA (x )
Soft Computing 51 /
Basic fuzzy set operations: Sum and Difference
Sum (A + B):
µA+B (x ) = µA (x ) + µB (x ) − µA (x ) ·
µB (x )
Difference (A − B = A ∩ BC ):
µA−B (x ) = µA∩B C (x )
µ = max{ 0, µ (x ) + µ (x )
Soft Computing 52 /
Basic fuzzy set operations: Equality and Power
Equality (A = B):
µA (x ) = µB (x )
µAα (x ) =
{ µA (x )} α
Soft Computing 53 /
Basic fuzzy set operations: Cartesian product
Example 3:
A(x) = {(x 1 , 0.2), (x2, 0.3), (x3, 0.5), (x4,
0.6)} y1 y2 y3
Soft Computing 54 /
Properties of fuzzy sets
Commutativity :
A∪B =
B∪A A∩B
= B∩A
Associativity :
A ∪ (B ∪ C) = (A ∪ B)
∪ C A ∩ (B ∩ C) = (A
∩ B) ∩ C
Distributivity :
A ∪ (B ∩ C) = (A ∪ B) ∩
(A ∪ C)
A ∩ (B ∪ C) = (A ∩ B) ∪
Soft(A ∩ C)
Computing 55 /
Properties of fuzzy sets
Idempotence :
A ∪ A =
A
A ∩ A =
∅A∪ ∅
= A A∩
Transitivity : ∅=∅
If A ⊆ B, B ⊆ C then A ⊆
C
Involution :
(Ac ) c = A
De Morgan’s law :
(A ∩ B) c = Ac ∪ Bc
(ASoft
∪ Computing
B) c = Ac ∩ Bc 56 /
Few Illustrations on Fuzzy
Sets
Soft Computing 57 /
Example 1: Fuzzy Set Operations
a4 x
Soft Computing 58 /
Example 1: Plotting two sets on the same graph
µB µA
µ
b1
a1
a2 b 4 a3 a 4 x
Soft Computing 59 /
Example 1: Union and Intersection
The plots of union A ∪ B and intersection A ∩ B are
shown in the following.
µB µA
b1
a1
a2 b 4 a3 a4 x
A B ( )x
A B ( )x
a2 b4
x b1 a1 a2 a3 a4
x
Soft Computing 60 /
Example 1: Intersection
( )x
A
a b a b
x x
Soft Computing 61 /
Fuzzy set operations: Practice
i. A , B
ii. A ∪ B
iii. A ∩ B
iv. (A ∪ B) c [Hint: Use De’ Morgan law]
Soft Computing 62 /
Example 2: A real-life example
µA µB
1.0
0.5
µ
-15 -10 -5 0 5 10 15 20 25 30 35 40 45 50
Soft Computing 63 /
Example 2: A real-life example
Pleasant climate
Note: Note that ”Not cold climate” =
̸ ”Hot climate” and
vice-versa.
Soft Computing 64 /
Example 2 : A real-life example
Answer would be the
following.
1 Not cold climate
A with 1 − µA (x ) as the
2 MF. hot climate
Not
B with 1 − µB (x ) as the
3 MF.
Extreme climate
A ∪ B with µA∪B (x ) = max(µA(x ), µB (x )) as
4 the MF. climate
Pleasant
A ∩ B with µA∩B (x ) = min(µA(x ), µB (x )) as the MF.
The plot of the MFs of A ∪ B and A ∩ B are shown in the
following. Extreme Pleasant
1.0 climate
µA climate
1.0 µB
A B
A B
0.
5
µ
- -
15 10 -5 0 5 10 15 20 25 30 35 40 45 50
x
5 15 25 5 25
x x
Soft Computing 65 /
Few More on Membership
Functions
Soft Computing 66 /
Generation of MFs
Given a membership function of a fuzzy set representing a
linguistic hedge, we can derive many more MFs
representing several other linguistic hedges using the
concept of Concentration and Dilation.
Concentration:
Ak = [µA (x )]k ; k > 1
Dilation:
Ak = [µA (x )]k ; k < 1
Example : Age = { Young, Middle-aged, Old }
Thus, corresponding to Young, we have : Not young, Very
young, Not very young and so on.
Similarly, with Old we can have : old, very old, very very old,
extremely old etc.
Thus, Extremely old = (((old ) 2 ) 2 ) 2 and so on
Soft Computing
0.5 0.5 67 /
Linguistic variables and values
Very
Old
Very young
0 30 60 100
X=
Age
Soft Computing 69 /