Fuzzy Logic
Assist. Prof.
Dr. Heba M. Fadhil
A brief history of Fuzzy Logic
First time introduced by Lotfi Abdelli Zadeh (1965), University of
California, Berkley, USA (1965).
He is fondly nick-named as LAZ
What is Fuzzy logic?
Fuzzy logic is a mathematical language to express something.
This means it has grammar, syntax, semantic like a language for
communication.
There are some other mathematical languages also known
• Relational algebra (operations on sets)
• Boolean algebra (operations on Boolean variables)
• Predicate logic (operations on well formed formulae (wff), also
called predicate propositions)
Fuzzy logic deals with Fuzzy set.
Example : Fuzzy logic vs. Crisp logic
Yes or No
Crisp answer
True or False
Milk Yes
Water
A liquid
Crisp
Coca
No
Spite
Is the liquid
colorless?
Example : Fuzzy logic vs. Crisp logic
May be
May not be
Fuzzy answer Absolutely
Partially
etc
Example : Fuzzy logic vs. Crisp logic
Score
99
Extremely honest
• Ankit
• Rajesh
Very honest 75
• Santosh
Fuzzy
• Kabita Honest at times 55
• Salmon
Extremely dishonest 35
Is the person
honest?
Concept of fuzzy system
Fuzzy element(s)
Fuzzy set(s)
Our world is
I better described
Fuzzy rule(s) with fuzzily!
N
P
U
Fuzzy implication(s)
T (Inferences)
O
U
T
Fuzzy system P
U
T
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 }
Concept of Universe of discourse X
fuzzy set
H
M
Here, All are the sets of finite numbers of individuals.
Such a set is called crisp set.
Example of fuzzy set
Let us discuss about fuzzy set.
X = All students in IT60108.
S = All Good students.
S = { (s, g) | s ∈ X } and g(s) is a measurement of
goodness of the student s.
Example:
S = { (Rajat, 0.8), (Kabita, 0.7), (Salman, 0.1),
(Ankit, 0.9) } etc.
Fuzzy set vs. Crisp set
Crisp Set Fuzzy Set
1. F = (s, µ) | s ∈ X and
1. S = { s | s ∈ X } µ(s) is the degree of s.
2. It is a collection of elements. 2. It is collection of ordered pairs.
3. Inclusion of an element s ∈ 3. Inclusion of an element s ∈ X
X into S is crisp, that is, has
strict boundary yes or no. into F is fuzzy, that is, if present, then
with a degree of membership.
Fuzzy set vs. Crisp set
Note: A crisp set is a fuzzy set, but, a fuzzy set is not necessarily a 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.
How to decide the degree of memberships of elements in a fuzzy set?
City Bangalore Bombay Hyderabad Kharagpur Madras Delhi
DoM 0.95 0.90 0.80 0.01 0.65 0.75
How the cities of comfort can be judged?
Example: Course evaluation in a crisp way
1 EX = Marks ≥ 90
2 A = 80 ≤ Marks < 90
3 B = 70 ≤ Marks < 80
4 C = 60 ≤ Marks < 70
5 D = 50 ≤ Marks < 60
6 P = 35 ≤ Marks < 50
7 F = Marks < 35
Example: Course evaluation in a crisp way
Example:
Course
evaluation
in a fuzzy
way
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].
Some basic terminologies and notations
• Definition 1: Membership function (and Fuzzy set)
• If X is a universe of discourse and x ∈X, then a fuzzy set A in X is defined as a set of ordered pairs, that is
• A = {( x,µA(x))|x ∈X} where µA(x) is called the membership function for the fuzzy set A.
• 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?
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)}
Membership function with discrete membership values
The membership values may be of discrete values.
Either elements or their membership values (or both) also may be
of discrete values.
Membership
A ={(0,0.1),(1,0.30),(2,0.78)……(10,0.1)}
1.0
function with
0.8
0.6 Note : X = discrete value
discrete
µ
0.4 membership
0.2
0 2 4 6 8 10
How you measure happiness ?? values
Number of children (X)
A = “Happy family”
with continuous membership
values
Membership 1.0
0.8
B ( x) = 1
x−50
1+
10
4
function
0.6
0.4
0.2
0 50 100
B
Age (X)
Note : x = real value
B = “Middle aged” = R+
Fuzzy terminologies: Support
Support: The support of a fuzzy set A is the set of all points x ∈ X
such that µA(x ) > 0
A
Core: The core of a fuzzy set A is the set of all points x in X such that
µA(x ) = 1
core (A) = {x | µA(x) = 1}
1.0
µ
0.5
Fuzzy terminologies: Core
Fuzzy terminologies: Normality
Normality : A fuzzy set A is a normal if its core is
non-empty. In other words, we can always find a
point x ∈ X such that µA(x ) = 1.
1.0
Fuzzy terminologies: Crossover points
Crossover point : A crossover point of a fuzzy set A
is a point x ∈ X
at which µA(x ) = 0.5. That is
Crossover (A)= { x |µA(x ) = 0.5}.
Fuzzy terminologies: Fuzzy Singleton
Fuzzy Singleton : A fuzzy set whose support is a single point in X
with µA(x ) = 1 is called a fuzzy singleton. That is
|A| = { x | µA(x ) = 1}.
Fuzzy Membership Functions
Soft Computing Applications
Fuzzy termin
Symmetry :
A fuzzy set A is symmetric if its membership function around a certain
point x = c, namely µA(x + c) = µA(x - c) for all x ∈ X.
Soft Computing Applications
Fuzzy terminolo
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 →−∞ µA(x) = limx →+∞ µA(x) = 0
Open left Open right
Closed
Soft Computing Applications
Fuzzy
Fuzzy : When we say about certainty of a thing
Example: A patient come to the doctor and he has to diagnose so that
medicine can be prescribed.
• Doctor prescribed a medicine with certainty 60% that the patient is
suffering from flue. So, the disease will be cured with certainty of 60% and
uncertainty 40%. Here, in stead of flue, other diseases with some other
certainties may be.
Probability: When we say about the chance of an event to occur
• Example: India will win the T20 tournament with a chance 60% means
that out of 100 matches, India own 60 matches.
Soft Computing Applications
Prediction
The Fuzzy vs. Probability is analogical to Prediction vs. Forecasting
• Prediction : When you start guessing about things.
• Forecasting : When you take the information from the past job
and apply it to new job.
The main difference:
• Prediction is based on the best guess from experiences.
• Forecasting is based on data you have actually recorded and
packed from previous job.
Soft Computing Applications
Fuzzy mem
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 2 4 6 8 10 0 10 20 30 40 50 60
Number of children (X) Age (X)
A = Fuzzy set of “Happy family” B = “Young age”
Soft Computing Applications
Fuzzy mem
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
< triangular > < trapezoidal > < curve >
µ
µ
x x
< non-uniform > < non-uniform >
Soft Computing Applications
Fuzzy MFs : Formu
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
b−a
if a ≤ x ≤ b
triangle( x ; a, b, c ) = (1)
c−x
c−b
if b ≤ x ≤ c
0 if c ≤ x
1.0
a b c
Soft Computing Applications 38 / 69
Fuzzy M
A trapezoidal MF is specified by four parameters {a, b, c, d } and can
be defined as follows:
0 if x ≤ a
x −a
b−a if a ≤ x ≤ b
trapeziod (x ; a, b, c, d ) = 1 if b ≤ x ≤ c (2)
d −x
d −c if c ≤ x ≤ d
0 if d ≤ x
1.0
a b c d
Soft Computing Applications
Fuzzy M
A Gaussian MF is specified by two parameters {c, σ} and can be
defined as below:
—1 ( x −σ c 2
gaussian(x;c,σ) =e 2 ) .
c
0.1
0.1c 0.9c
Soft Computing Applications
Fuzzy MFs
It is also called Cauchy MF. A generalized bell MF is specified by three
parameters {a, b, c } and is defined as:
bell(x; a, b, c)= 1+| x1− c |2b
a
b
Slope at x =
2a
b
Slope at y = −
x b y
2a
c-a c c+a
Soft Computing Applications
Example: Generalized bell MFs
1
Example: µ(x)= 1+x 2 ;
a = b = 1 and c = 0;
1.0
-1 0 1
Soft Computing Applications
Fuzzy MF
Parameters: {a, c } ; where c = crossover point and a = slope at c;
1
Sigmoid(x;a,c)= a ]
1+ e − [ x − c
1.0
Slope = a
0.5
Soft Computing Applications
Fuzzy M
Example : Consider the following grading system for a course.
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 Applications
Grad
A fuzzy implementation will look like the following.
Bad poor Average Good Very Good Excellent
1
.8
.6
.4
.2
0
10 20 30 40 50 60 70 80 90
marks
You can decide a standard fuzzy MF for each of the fuzzy garde.
Soft Computing Applications