Introduction to fuzzy logic
Franck Dernoncourt
franck.dernoncourt@gmail.com
MIT, January 2013
Contents
Contents
List of Figures
1 Introduction
1.1 Set theory refresher . . . . . . . . . . . . . . . . . . . . . . . . . . .
i
ii
1
2
2 Fuzzy logic
5
5
2.1 Fuzzy sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
2.2 The linguistic variables . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 The fuzzy operators
2.4 Reasoning in fuzzy logic . . . . . . . . . . . . . . . . . . . . . . . . 11
2.5 The defuzzification . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.6 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3 Training fuzzy inference systems
18
3.1 Neuro-fuzzy systems . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2 Evolutionary computation . . . . . . . . . . . . . . . . . . . . . . . 19
4 Acknowledgments
Bibliography
20
21
i
List of Figures
1.1 Graphical representation of the set {1, 5, 6, 7, 10} . . . . . . . . . . . .
1.2 Union of two sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3
Intersection of two sets . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4 Graphical representation of sets . . . . . . . . . . . . . . . . . . . . . .
”The classical set theory is a subset of the theory of fuzzy sets” . . . .
2.1
2.2 Membership function characterizing the subset of ’good’ quality of
service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 Graphical representation of a conventional set and a fuzzy set . . . . .
2.4 Comparison between a identity function of a conventional set and a
2
3
3
4
5
6
7
7
membership function of fuzzy set . . . . . . . . . . . . . . . . . . . . .
8
2.5 A membership function with properties displayed . . . . . . . . . . . .
9
2.6 Linguistic variable ’quality of service’ . . . . . . . . . . . . . . . . . . .
9
2.7 Linguistic variable ’quality of food’ . . . . . . . . . . . . . . . . . . . .
2.8 Linguistic variable ’tip amount’ . . . . . . . . . . . . . . . . . . . . . . 10
2.9 Example of fuzzy implication . . . . . . . . . . . . . . . . . . . . . . . 12
2.10 Example of fuzzy implication with conjunction OR translated into a
MAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.11 Example of fuzzy implication using the decision matrix . . . . . . . . 13
2.12 Defuzzification with the method of the mean of maxima (MeOM) . . . 14
2.13 Defuzzification with the method of center of gravity (COG) . . . . . . 15
2.14 Overview diagram of a fuzzy system: . . . . . . . . . . . . . . . . . . . 16
2.15 Decisions of a system based on fuzzy system . . . . . . . . . . . . . . . 16
2.16 Decisions of a system based on classical logic . . . . . . . . . . . . . . 17
3.1 Example of a feedforward neural network . . . . . . . . . . . . . . . . 18
3.2 Structure of a neuro-fuzzy system . . . . . . . . . . . . . . . . . . . . . 19
ii
Chapter 1
Introduction
Fuzzy logic is an extension of Boolean logic by Lotfi Zadeh in 1965 based on the
mathematical theory of fuzzy sets, which is a generalization of the classical set theory.
By introducing the notion of degree in the verification of a condition, thus enabling a
condition to be in a state other than true or false, fuzzy logic provides a very valuable
flexibility for reasoning, which makes it possible to take into account inaccuracies and
uncertainties.
One advantage of fuzzy logic in order to formalize human reasoning is that the rules
are set in natural language. For example, here are some rules of conduct that a driver
follows, assuming that he does not want to lose his driver’s licence:
If the light is red...
if my speed is high...
If the light is red...
if my speed is low...
is or-
the light
If
ange...
If the light is green...
if my speed is aver-
age...
if my speed is low...
and if the light is
close...
and if the light is
far...
and if the light is
far...
and if the light is
close...
then I brake hard.
then I maintain my
speed.
then I brake gently.
then I accelerate.
Intuitively, it thus seems that the input variables like in this example are approximately
appreciated by the brain, such as the degree of verification of a condition in fuzzy
logic.
To exemplify each definition of fuzzy logic, we develop throughout this introductory
course a fuzzy inference system whose specific objective is to decide the amount of
1
Introduction to fuzzy logic, by Franck Dernoncourt - (Home Page) (E-mail)
Page 2 of 20
a tip at the end of a meal in a restaurant, depending on the quality of service and
the quality of the food.
1.1 Set theory refresher
A set is a Many that allows itself to be thought of as a One. Georg
Cantor.
To begin with, a quick refresher on the classical sets can be useful if you haven’t
dealt with them for long time.
The classical set theory simply designates the branch of mathematics that studies
sets. For example, 5, 10, 7, 6, 9 is a set of integers. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
is the set of integers between 0 and 10. ’s’ ’d’; ’z’, ’a’ is a set of characters. ”Site”,
”of”, ”zero” is a set of words. We can also create sets of functions, assumptions,
definitions, sets of individuals (that is to say, a population), etc. and even sets of
sets!
Note that in a set, the order does not matter: 7, 6, 9 denotes the same set as 9, 7, 6.
However, to improve readability, it is convenient to classify the elements in ascending
order, ie 6, 7, 9. Usually, a set is denoted by a capital letter: thus, we write A = 6,
7, 9. The empty set is denoted ∅: it is a remarkable since it contains no element.
This seems unnecessary at first glance, but in fact, we will often use it.
Sets are often represented in graphic form, typically by circles, as figure 1.1 illustrates.
Figure 1.1: Graphical representation of the set {1, 5, 6, 7, 10}
The concept of belonging is important in set theory:
it refers to the fact that an
element is part of a set or not. For example, the integer 7 belongs to the set 6,
7, 9.
In contrast, the integer 5 does not belong to the set 6, 7, 9. Membership is
Copyright © 2013 - Franck Dernoncourt .
This tutorial is under the Creative Commons-BY-SA license. You are welcome to distribute it provided that
you keep the license and cite the author of this document.
http://francky.me
Introduction to fuzzy logic, by Franck Dernoncourt - (Home Page) (E-mail)
Page 3 of 20
symbolized by the character in the non-membership and by the same symbol, but
barred ossible. Thus, we have 7 ∈ {6, 7, 9} and 5 /∈ {6, 7, 9}.
A membership function (also called indicator function or characteristic function) is a
function that explicit membership or not a set E. Let f be the characteristic function
of the set E = {6, 7, 9}, and x is any integer:
TODO Math formula
This concept of membership is very important for this course because fuzzy logic is
based on the concept of fuzzy membership. This simply means that we can belong to
a set to 0.8, in contrast to classical set theory where as we have just seen membership
is either 0 (not owned) or 1 (part).
In order to manipulate classical ensembles and make something interesting, we define
a set of operations, which are very intuitive. Figures 1.2, 1.2 and
Figure 1.2: Union of two sets, denoted A ∪ B = {x ∈ Aextorx inB}. A ∪ B
corresponds to the blue area. For example if A = {6; 7; 9} et B = {1; 5; 6; 7; 10},
then A ∪ B = {1; 5; 6; 7; 9; 10}.
Figure 1.3: Intersection of two sets, denoted A ∩ B = {x ∈ Aetx ∈ B}. For
example, if A = {6; 7; 9} and B = {1; 5; 6; 7; 10}, then A ∩ B = {6; 7}.
Copyright © 2013 - Franck Dernoncourt .
This tutorial is under the Creative Commons-BY-SA license. You are welcome to distribute it provided that
you keep the license and cite the author of this document.
http://francky.me
Introduction to fuzzy logic, by Franck Dernoncourt - (Home Page) (E-mail)
Page 4 of 20
Figure 1.4: Here is the graphical representation of the sets A = {6, 7, 9} and
B = {1, 5, 6, 7, 10}. We see immediately that A ∪ B = {1, 5, 6, 7, 9, 10} and
A capB = {6, 7}.
But classical set theory is not the subject of this course, so we stop here. However,
as fuzzy logic is based on the concept of fuzzy, we see now the kind of problems that
we face and that we will solve in the next sections: how to define such a union if
memberships are not either 0 or 1?
Copyright © 2013 - Franck Dernoncourt .
This tutorial is under the Creative Commons-BY-SA license. You are welcome to distribute it provided that
you keep the license and cite the author of this document.
http://francky.me
Chapter 2
Fuzzy logic
As complexity rises, precise statements lose meaning and meaningful
statements lose precision. Albert Einstein.
2.1 Fuzzy sets
Fuzzy logic is based on the theory of fuzzy sets, which is a generalization of the
classical set theory. Saying that the theory of fuzzy sets is a generalization of the
classical set theory means that the latter is a special case of fuzzy sets theory. To
make a metaphor in set theory speaking, the classical set theory is a subset of the
theory of fuzzy sets, as figure 2.1 illustrates.
Figure 2.1: ”The classical set theory is a subset of the theory of fuzzy sets”
Fuzzy logic is based on fuzzy set theory, which is a generalization of the classical set
theory [Zadeh, 1965]. By abuse of language, following the habits of the literature,
we will use the terms fuzzy sets instead of fuzzy subsets. The classical sets are also
called clear sets, as opposed to vague, and by the same token classical logic is also
known as Boolean logic or binary.
5