Professional Documents
Culture Documents
Fuzzy Logic Basics
Fuzzy Logic Basics
Neurofuzzy Network
Neural Networks
Lesson 9 Fuzzy Logic
Prof. Michele Scarpiniti
INFOCOM Dpt. - Sapienza University of Rome
http://ispac.ing.uniroma1.it/scarpiniti/index.htm
michele.scarpiniti@uniroma1.it
M. Scarpiniti
1 / 37
Introduction
Neurofuzzy Network
Introduction
Basic Concepts
Fuzzy Logic
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
M. Scarpiniti
2 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Introduction
Introduction
M. Scarpiniti
3 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
M. Scarpiniti
4 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Fuzzy sets
Fuzzy sets are a further development of the mathematical concept of a set.
A set is any collection of objects which can be treated as a whole. Cantor
described a set by its members, such that an item from a given universe is
either a member or not. A set can be specified by its members, they
characterize a set completely. The list of members A = {0, 1, 2, 3}.
Nobody can list all elements of an infinite set, we must instead state some
property which characterizes the elements in the set, for instance the
predicate x > 10.
Following Zadeh many sets have more than an either-or criterion for
membership. Take for example the set of young people. A one year old baby
will clearly be a member of the set, and a 100 years old person will not be a
member of this set, but what about people at the age of 20, 30, or 40 years?
Another example is a weather report regarding high temperatures, strong
winds, or nice days. Zadeh proposed a grade of membership, such that the
transition from membership to non-membership is gradual rather than
abrupt.
M. Scarpiniti
5 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Fuzzy sets
The grade of membership for all its members thus describes a fuzzy set. An items
grade of membership is normally a real number between 0 and 1, often denoted .
The higher the number, the higher the membership. Zadeh regards Cantors set as
a special case where elements have full membership = 1. He nevertheless called
Cantors sets nonfuzzy , but today the term crisp set is used.
6 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Fuzzy sets
Notice that Zadeh does not give a formal basis for how to determine the grade
of membership. The membership for a 50 year old in the set young depends on
ones own view. The grade of membership is a precise, but subjective measure that
depends on the context.
Elements of a fuzzy set are taken from a universe. The universe contains all
elements that can come into consideration and it depends on the context. For
example the number between 0 and 100, or, for non-numerical quantity, bitter,
sweet, sour, salt, hot,....
M. Scarpiniti
7 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Membership function
Every element in the universe of discourse is a member of the fuzzy set to
some grade, maybe even zero. The set of elements that have a non-zero
membership is called the support of the fuzzy set. The function that ties a
number to each element x of the universe is called the membership function
(x). There are two alternative ways to represent a membership function:
continuous or discrete.
In the continuous form the membership function is a mathematical
function. A membership function is for example bell-shaped (also
called a -curve), s-shaped (called an s-curve), a reverse s-curve
(called z-curve), gaussian, triangular, or trapezoidal.
In the discrete form the membership function and the universe are
discrete points in a list (vector). Sometimes it can be more
convenient with a sampled (discrete) representation.
A fuzzy set is normalized if its largest membership value equals 1.
M. Scarpiniti
8 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Trapezoidal:
x a d x
(x) = max min
,
,0
ba d b
M. Scarpiniti
9 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Membership function
Other well-known membership functions are reported.
Gaussian:
(x a)2
(x) = exp
2b 2
Bell-shaped:
(x) =
1
xa 2b
1+
c
M. Scarpiniti
10 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Singletons
A fuzzy set A is a collection of ordered pairs
A = {(x, (x))}
Item x belongs to the universe and (x) is its grade of membership in A. A single
pair (x, (x)) is called a fuzzy singleton. Thus the whole set can be viewed as the
union of its constituent singletons. It is often convenient to think of a set A just
as a vector
a = [(x1 ), (x2 ), . . . , (xn )]
M. Scarpiniti
11 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Linguistic variables
Just like an algebraic variable takes numbers as values, a linguistic variable takes
words or sentences as values. The set of values that it can take is called its term
set. Each value in the term set is a fuzzy variable defined over a base variable.
The base variable defines the universe of discourse for all the fuzzy variables in the
term set. In short, the hierarchy is as follows: linguistic variable fuzzy variable
base variable.
Example
Let x be a linguistic variable with the label Age. Terms of this linguistic variable are
from the term set
T = {Old, VeryOld, NotSoOld, MoreOrLessYoung , QuiteYoung , Young , VeryYoung }
Each term is a fuzzy variable defined on the base variable, which might be the scale
from 0 to 100 years.
A primary term is a term or a set that must be defined a priori, for example
Young and Old, whereas the sets VeryYoung and NotYoung are modified.
M. Scarpiniti
12 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
M. Scarpiniti
13 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Intersection:
AB (x) = min (A (x), B (x))
Union:
AB (x) = max (A (x), B (x))
M. Scarpiniti
14 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Fuzzy logic
The fuzzy logic invalidate two of the strongholds of the classical logic:
1
Law (or principle) of the excluded third (or Tertium non datur in
Latin):
= True
AA
In this way the reasoning for fuzzy logic is different from the classical one:
Usually natural and artificial languages have some rules, of the type:
if then
For example:
if it is raining then we get wet;
if the pressure is high then the volume is small.
M. Scarpiniti
15 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Fuzzy reasoning
In the fuzzy reasoning the linguistic variable contained in a rule, are defined
by fuzzy sets:
if x is A then y is B
A and B are fuzzy sets defined on the universe X and Y ;
the values x X and y Y ;
the fuzzy rule defines a relation R on the space X Y ;
a fuzzy relation is a fuzzy set defined on several domains:
R = X Y Z ...
R (x, y , z, . . .)
16 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Fuzzy rules
A fuzzy rule is defined as a conditional statement in two forms:
1
Mamdami rules:
Takagi-Sugeno rules:
17 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Consequent: y is B
Modus Tollens
Premise: if (x is A) then (y is B)
Antecedent: y is not B
Consequent: x is not A
M. Scarpiniti
18 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Consequent: y is B 0
B 0 (y ) = max (min (A0 (x), R (x, y )))
X
Example
Premise: if the tomato is red then it is sweet, possibly sweet-sour, and likely to be sour.
Antecedent: The tomato is more or less red (Red = 0.8).
Consequent: Taste = ?
M. Scarpiniti
19 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
M. Scarpiniti
20 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
M. Scarpiniti
21 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
M. Scarpiniti
22 / 37
Introduction
Neurofuzzy Network
Basic Concepts
Fuzzy Logic
Defuzzification
Defuzzification is the process of producing a quantifiable result in fuzzy logic. A
fuzzy quantity is converted into a crisp one (a single number). Defuzzifier is the
system implementing the defuzzification. Several methods are implemented for
defuzzification.
1 Centroid point:
R
x(x)dx
xC = Rx
(x)dx
x
2
N
1 X
MAX (xi )
N
i=1
Minimum Max:
xM = min {MAX (xi )}
X
M. Scarpiniti
23 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
Neurofuzzy Network
Neurofuzzy Network
M. Scarpiniti
24 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
Fuzzy Model
rules
reasoning
clustering and rules inserting
Fuzzy Model
direct information
The linguistic information can be used directly into the neurofuzzy network: this
possibility is not done for the digital circuits, where these properties must be kept
into account with particular data transformations.
M. Scarpiniti
25 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
Neurofuzzy networks
The term neurofuzzy refers to combinations of artificial neural networks and fuzzy
logic. Neurofuzzy hybridization results in a hybrid intelligent system that synergies
these two techniques by combining the human-like reasoning style of fuzzy systems with the learning and connectionist structure of neural networks. Neurofuzzy
hybridization is widely termed as Fuzzy Neural Network (FNN) or Neuro-Fuzzy
System (NFS) in the literature. Neurofuzzy system incorporates the human-like
reasoning style of fuzzy systems through the use of fuzzy sets and a linguistic model
consisting of a set of IF-THEN fuzzy rules. The main strength of neurofuzzy systems is that they are universal approximators with the ability to solicit interpretable
IF-THEN rules.
The strength of neurofuzzy systems involves two contradictory requirements in
fuzzy modeling: interpretability versus accuracy. In practice, one of the two properties prevails.
We can show two type of neurofuzzy systems: the first type following the
Mamdamis rules and the second one following the Takagi-Sugenos rules.
M. Scarpiniti
26 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
Neurofuzzy networks
A neurofuzzy network of the first type is depicted in the following figure:
the output of this network is an expansion of the input following some basis
given by the rules.
M. Scarpiniti
27 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
Neurofuzzy networks
A neurofuzzy network of
the second type is depicted
in the following figure: it is
an example of a first order
function f (x). This kind
of neurofuzzy network realize an input-output relation as a linear piecewise approximation with
smoothing at the border.
In fact each rule is locally
defined on a small region
of the input data.
M. Scarpiniti
28 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
29 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
projecting the clusters to the axis of the input space, determining the
fuzzy values Aik for the rules antecedent;
M. Scarpiniti
30 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
Fuzzy Clustering
In fuzzy clustering, data elements can belong to more than one cluster, and
associated with each element is a set of membership levels. These indicate
the strength of the association between that data element and a particular
cluster.
We can modify well-known clustering algorithm in order to obtain
new fuzzy version of this algorithm. Another procedure is to consider
several procedures valid for fuzzy sets and develop new clustering
algorithm.
We will show two clustering algorithms, one for each category:
1
2
M. Scarpiniti
31 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
Fuzzy C-means
Given as examples the N vectors Xk , k = 1, 2, . . . , N, the C-means algorithm is summarized below:
Fuzzy C-means algorithm
1
PN
k=1
= P
N
m
ik Xk
k=1
m
ik
i = 1, 2, . . . , C
evaluating the sum of the distance of the new centroid from the old ones:
E =
C
X
0
Vi Vi
i=1
if E < with a small positive and arbitrary threshold stop the algorithm, else
repeat from step 2.
M. Scarpiniti
32 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
Fuzzy Min-Max
The Min-Max clustering algorithm uses a neurofuzzy network called MinMax and is based on the subdivision of the data space into hypercubes
(HC) defined by a couple of points.
1
M. Scarpiniti
33 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
Fuzzy Min-Max
An example of Min-Max clustering algorithm is reported in the following
figure.
M. Scarpiniti
34 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
M. Scarpiniti
35 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
M. Scarpiniti
36 / 37
Introduction
Neurofuzzy Network
Neurofuzzy Network
Fuzzy Clustering
References
L.A. Zadeh.
Fuzzy sets.
Information and Control, Vol. 8, pp. 338-353, 1965.
V. Kecman.
Learning and Soft Computing. Support Vector Machines, Neural Networks and Fuzzy Logic
Models
The MIT Press, 2001.
O. Maimon and L. Rokach.
Soft Computing for Knowledge Discovery and Data Mining.
Springer, 2008.
M. Scarpiniti
37 / 37