0% found this document useful (0 votes)
5 views80 pages

Computational Intelligence - Ccs619: Fuzzy Logic

Uploaded by

mansour
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views80 pages

Computational Intelligence - Ccs619: Fuzzy Logic

Uploaded by

mansour
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

COMPUTATIONAL INTELLIGENCE - CCS619

FUZZY LOGIC

Jan., 2023
NASEEBAH A. MAQTARY
PhD in Computing
Head of Computer Science Dept.

Office: CS-office in Faculty building


Email: [email protected]
LECTURE OUTLINE

 Operations
 Definitions
 Properties
 Bit of History
 Fuzzy Rules
 Fuzzy Applications
 Examples
 Fuzzy Sets
 Fuzzy Inference
 Fuzzy Boundaries
• Fuzzification of the input variables
 Fuzzy Representation • Rule evaluation

 Linguistic Variables and Hedges • Aggregation of the rule outputs


• Defuzzification
 Characteristics of Fuzzy Sets
 Mamdani
 Sugeno
DEFINITION

 Experts rely on common sense when they solve problems.

 How can we represent expert knowledge that uses vague and ambiguous terms in a computer?

 Fuzzy logic is not logic that is fuzzy, but logic that is used to describe fuzziness. Fuzzy logic is the theory of fuzzy
sets, sets that calibrate vagueness.

 Fuzzy logic is based on the idea that all things admit of degrees. Temperature, height, speed, distance, beauty – all
come on a sliding scale.
 The motor is running really hot.
 Tom is a very tall guy.
DEFINITION

 The concept of a set and set theory are powerful concepts in mathematics. However, the principal notion
underlying set theory, that an element can (exclusively) either belong to set or not belong to a set, makes it well nigh
impossible to represent much of human discourse. How is one to represent notions like:
 large profit
 high pressure
 tall man
 moderate temperature
 Ordinary set-theoretic representations will require the maintenance of a crisp differentiation in a very artificial
manner:
 high
 not quite high
 very high … etc.
DEFINITION

 Many decision-making and problem-solving tasks are too complex to be understood quantitatively, however, people
succeed by using knowledge that is imprecise rather than precise.

 Fuzzy set theory resembles human reasoning in its use of approximate information and uncertainty to generate
decisions.

 It was specifically designed to mathematically represent uncertainty and vagueness and provide formalized tools for
dealing with the imprecision intrinsic to many problems.
DEFINITION

 Since knowledge can be expressed in a more natural way by using fuzzy sets, many engineering and decision
problems can be greatly simplified.

 Boolean logic uses sharp distinctions. It forces us to draw lines between members of a class and non-members. For
instance, we may say, Tom is tall because his height is 181 cm. If we drew a line at 180 cm, we would find that
David, who is 179 cm, is small.

 Is David really a small man or we have just drawn an arbitrary line in the sand?
BIT OF HISTORY

 Fuzzy, or multi-valued logic, was introduced in the 1930s by Jan Lukasiewicz, a Polish philosopher.
While classical logic operates with only two values 1 (true) and 0 (false), Lukasiewicz introduced
logic that extended the range of truth values to all real numbers in the interval between 0 and 1.

 For example, the possibility that a man 181 cm tall is really tall might be set to a value of 0.86. It
is likely that the man is tall. This work led to an inexact reasoning technique often called
possibility theory.

 In 1965 Lotfi Zadeh, published his famous paper “Fuzzy sets”. Zadeh extended the work on
possibility theory into a formal system of mathematical logic, and introduced a new concept for
applying natural language terms. This new logic for representing and manipulating fuzzy terms was
called fuzzy logic.
WHY?

 Why fuzzy?

As Zadeh said, the term is concrete, immediate and descriptive; we all know what it means.
However, many people in the West were repelled by the word fuzzy, because it is usually used in a
negative sense.

 Why logic?

Fuzziness rests on fuzzy set theory, and fuzzy logic is just a small part of that theory.
THE TERM “FUZZY LOGIC”

 The term fuzzy logic is used in two senses:

 Narrow sense: Fuzzy logic is a branch of fuzzy set theory, which deals (as logical systems do) with the representation and inference from
knowledge. Fuzzy logic, unlike other logical systems, deals with imprecise or uncertain knowledge. In this narrow, and perhaps correct
sense, fuzzy logic is just one of the branches of fuzzy set theory.

 Broad Sense: fuzzy logic synonymously with fuzzy set theory


FUZZY APPLICATIONS

 Theory of fuzzy sets and fuzzy logic has been applied to problems in a variety of fields:
 taxonomy; topology; linguistics; logic; automata theory; game theory; pattern recognition; medicine; law; decision support; Information
retrieval; etc.

 And more recently fuzzy machines have been developed including:


 automatic train control; tunnel digging machinery; washing machines; rice cookers; vacuum cleaners; air conditioners, etc.
FUZZY APPLICATIONS

 Extraklasse Washing Machine - 1200 rpm. The Extraklasse machine has a number of features
which will make life easier for you.
 Fuzzy Logic detects the type and amount of laundry in the drum and allows only as much water to
enter the machine as is really needed for the loaded amount. And less water will heat up quicker -
which means less energy consumption.
 Foam detection: Too much foam is compensated by an additional rinse cycle: If Fuzzy Logic detects the formation of
too much foam in the rinsing spin cycle, it simply activates an additional rinse cycle. Fantastic!
 Imbalance compensation
In the event of imbalance, Fuzzy Logic immediately calculates the maximum possible speed, sets this speed and
starts spinning. This provides optimum utilization of the spinning time at full speed
 Washing without wasting - with automatic water level adjustment

 Fuzzy automatic water level adjustment adapts water and energy consumption to the individual
requirements of each wash programme, depending on the amount of laundry and type of fabric
MORE DEFINITIONS
 Fuzzy logic is a set of mathematical principles for knowledge representation based on
degrees of membership.

 Unlike two-valued Boolean logic, fuzzy logic is multi-valued. It deals with degrees of
membership and degrees of truth.

 Fuzzy logic uses the continuum of logical values between 0 (completely false) and 1
(completely true). Instead of just black and white, it employs the spectrum of colours,
accepting that things can be partly true and partly false at the same time.

0 0 0 1 1 1 0 0 0.2 0.4 0.6 0.8 1 1


(a) Boolean Logic. (b) Multi-valued Logic.
FUZZY SETS
Degree of Membership
Name Height, cm
Crisp Fuzzy
 The concept of a set is fundamental to mathematics. Chris 208 1 1.00
Mark 205 1 1.00
 However, our own language is also the supreme expression John 198 1 0.98
of sets. For example, car indicates the set of cars. When we Tom 181 1 0.82
say a car, we mean one out of the set of cars.
David 179 0 0.78
Mike 172 0 0.24
 The classical example in fuzzy sets is tall men. The Bob 167 0 0.15
elements of the fuzzy set “tall men” are all men, but their
degrees of membership depend on their height. Steven 158 0 0.06
Bill 155 0 0.01
Peter 152 0 0.00
CRISP VS FUZZY SETS Degree of
Membership
Crisp Sets
1.0

0.8
The x-axis represents the universe of Tall Men
0.6
discourse – the range of all possible
0.4
values applicable to a chosen variable. In
0.2
our case, the variable is the man height.
0.0
According to this representation, the 150 160 170 180 190 200 210
universe of men’s heights consists of all Degree of
Height, cm
Fuzzy Sets
tall men. Membership
1.0
The y-axis represents the membership 0.8
value of the fuzzy set. In our case, the 0.6
fuzzy set of “tall men” maps height values 0.4
into corresponding membership values. 0.2

0.0
150 160 170 180 190 200 210
Height, cm
A FUZZY SET HAS FUZZY BOUNDARIES

 Let X be the universe of discourse and its elements be denoted as x. In the classical set theory, crisp set A of X is
defined as function fA(x) called the characteristic function of A:

fA(x) : X → {0, 1}, where 1, if x  A


f A ( x) = 
0, if x  A
This set maps universe X to a set of two elements. For any element x of universe X, characteristic function fA(x) is
equal to 1 if x is an element of set A, and is equal to 0 if x is not an element of A.
A FUZZY SET HAS FUZZY BOUNDARIES

 In the fuzzy theory, fuzzy set A of universe X is defined by function µA(x) called the membership function of set A

µA(x) : X → {0, 1}, where µA(x) = 1 if x is totally in A;


µA(x) = 0 if x is not in A;
0 < µA(x) < 1 if x is partly in A.

This set allows a continuum of possible choices. For any element x of universe X, membership function µA(x)
equals the degree to which x is an element of set A. This degree, a value between 0 and 1, represents the degree
of membership, also called membership value, of element x in set A.
FUZZY SET REPRESENTATION
Degree of
Membership Crisp Sets
1.0

0.8 Short Average Short


Tall
Tall Men
 First, we determine the membership functions. In our 0.6
“tall men” example, we can obtain fuzzy sets of tall, 0.4
short and average men. 0.2

0.0
150 160 170 180 190 200 210
Height, cm
 The universe of discourse – the men’s heights – Degree of
Fuzzy Sets
Membership
consists of three sets: short, average and tall men. As 1.0
you will see, a man who is 184 cm tall is a member of 0.8
the average men set with a degree of membership of 0.6 Short Average Tall

0.1, and at the same time, he is also a member of the 0.4


tall men set with a degree of 0.4. 0.2 Tall

0.0
150 160 170 180 190 200 210
FUZZY SET REPRESENTATION

 Typical functions that can be used to represent a fuzzy set are sigmoid, gaussian and pi. However, these functions
increase the time of computation. Therefore, in practice, most applications use linear fit functions.

 (x)
X Fuzzy Subset A
1

0
x
Crisp Subset A Fuzziness Fuzziness
LINGUISTIC VARIABLES AND HEDGES

 At the root of fuzzy set theory lies the idea of linguistic variables.
 A linguistic variable is a fuzzy variable. For example, the statement “John is tall”
implies that the linguistic variable John takes the linguistic value tall. IF wind is strong
 In fuzzy expert systems, linguistic variables are used in fuzzy rules. THEN sailing is good

 The range of possible values of a linguistic variable represents the universe of IF project_duration is long
discourse of that variable. For example, the universe of discourse of the THEN completion_risk is high
linguistic variable speed might have the range between 0 and 220 km/h and
may include such fuzzy subsets as very slow, slow, medium, fast, and very fast. IF speed is slow
 A linguistic variable carries with it the concept of fuzzy set qualifiers, called THEN stopping_distance is short
hedges.
 Hedges are terms that modify the shape of fuzzy sets. They include adverbs
such as very, somewhat, quite, more or less and slightly.
LINGUISTIC VARIABLES AND HEDGES

Degree of
Membership
1.0
Short Short
Tall
0.8

0.6 Average

0.4
Very Short Very
VeryTall
Tall
0.2 Tall

0.0
150 160 170 180 190 200 210
Height, cm
LINGUISTIC VARIABLES AND HEDGES
Mathematical Mathematical
Hedge Graphical Representation Hedge Graphical Representation
Expression Expression

A little [A ( x )]1.3 Very very [A ( x )]4

More or less A ( x )
Slightly [A ( x )]1.7

Somewhat A ( x )
Very [A ( x )] 2

2 [A ( x )]2
if 0  A  0.5
Indeed
Extremely [A ( x )]3 1 − 2 [1 − A ( x )]2
if 0.5 < A  1
CHARACTERISTICS OF FUZZY SETS

 The classical set theory developed in the late 19th century by Georg Cantor describes how crisp sets can interact.
These interactions are called operations.
 Also fuzzy sets have well defined properties.

 These properties and operations are the basis on which the fuzzy sets are used to deal with uncertainty on the one
hand and to represent knowledge on the other.
 Membership Functions: For the sake of convenience, usually a fuzzy set is denoted as:
A = A(xi)/xi + …………. + A(xn)/xn
where A(xi)/xi (a singleton) is a pair “grade of membership” element, that belongs to a finite universe of
discourse:
A = {x1, x2, .., xn}
COMPLEMENT

 Crisp Sets: Who does not belong to the set?

 Fuzzy Sets: How much do elements not belong to the set?

 The complement of a set is an opposite of this set. For example, if we have the set of tall men, its complement is
the set of NOT tall men. When we remove the tall men set from the universe of discourse, we obtain the
complement.

 If A is the fuzzy set, its complement A can be found as follows:


A(x) = 1 − A(x)
CONTAINMENT

 Crisp Sets: Which sets belong to which other sets?

 Fuzzy Sets: Which sets belong to other sets?

 Similar to a Chinese box, a set can contain other sets. The smaller set is called the subset. For example, the set of
tall men contains all tall men; very tall men is a subset of tall men. However, the tall men set is just a subset of the
set of men. In crisp sets, all elements of a subset entirely belong to a larger set. In fuzzy sets, however, each
element can belong less to the subset than to the larger set. Elements of the fuzzy subset have smaller
memberships in it than in the larger set.
INTERSECTION

 Crisp Sets: Which element belongs to both sets?


 Fuzzy Sets: How much of the element is in both sets?

 In classical set theory, an intersection between two sets contains the elements shared by these sets. For example,
the intersection of the set of tall men and the set of fat men is the area where these sets overlap. In fuzzy sets, an
element may partly belong to both sets with different memberships.

 A fuzzy intersection is the lower membership in both sets of each element. The fuzzy intersection of two fuzzy sets A
and B on universe of discourse X:
AB(x) = min [A(x), B(x)] = A(x)  B(x),
where xX
UNION

 Crisp Sets: Which element belongs to either set?


 Fuzzy Sets: How much of the element is in either set?

 The union of two crisp sets consists of every element that falls into either set. For example, the union of tall men
and fat men contains all men who are tall OR fat.

 In fuzzy sets, the union is the reverse of the intersection. That is, the union is the largest membership value of the
element in either set. The fuzzy operation for forming the union of two fuzzy sets A and B on universe X can be given
as:
AB(x) = max [A(x), B(x)] = A(x)  B(x),
where xX
OPERATIONS OF FUZZY SETS
(x) (x)
B
1 1 A
Not A
B A
0 0
x x
A AA B
1 1 A
Not A
0 0
x x
Complement Containment
Complement Containment
(x) (x)

1 1
A B A B
A B AA B 0 0
x x
1 AB 1
AB
0 0
Intersection Union x x
Intersection Union
PROPERTIES OF FUZZY SETS

 Equality of two fuzzy sets

 Inclusion of one set into another fuzzy set

 Cardinality of a fuzzy set

 An empty fuzzy set

 -cuts (alpha-cuts)
EQUALITY

 Fuzzy set A is considered equal to a fuzzy set B, IF AND ONLY IF (iff):


A(x) = B(x), xX

Consider X = {1, 2, 3} and sets A and B

A = 0.3/1 + 0.5/2 + 1/3


B = 0.3/1 + 0.5/2 + 1/3

therefore A = B
INCLUSION

 Inclusion of one fuzzy set into another fuzzy set. Fuzzy set A  X is included in (is a subset of) another fuzzy set, B  X:
A(x)  B(x), xX

Consider X = {1, 2, 3} and sets A and B

A = 0.3/1 + 0.5/2 + 1/3;


B = 0.5/1 + 0.55/2 + 1/3

then A is a subset of B, or A  B
CARDINALITY

 Cardinality of a non-fuzzy set, Z, is the number of elements in Z. BUT the cardinality of a fuzzy set A, the so-called SIGMA COUNT, is
expressed as a SUM of the values of the membership function of A, A(x):

cardA = A(x1) + A(x2) + … A(xn) = ΣA(xi), for i=1..n

Consider X = {1, 2, 3} and sets A and B

A = 0.3/1 + 0.5/2 + 1/3;


B = 0.5/1 + 0.55/2 + 1/3

cardA = 1.8
cardB = 2.05
EMPTY FUZZY SET

 A fuzzy set A is empty, IF AND ONLY IF:


A(x) = 0, xX

Consider X = {1, 2, 3} and set A

A = 0/1 + 0/2 + 0/3

then A is empty
ALPHA-CUT

 An -cut or -level set of a fuzzy set A  X is an ORDINARY SET A  X, such that:


A={A(x), xX}.

Consider X = {1, 2, 3} and set A

A = 0.3/1 + 0.5/2 + 1/3

then A0.5 = {2, 3},


A0.1 = {1, 2, 3},
A1 = {3}
FUZZY SET NORMALITY

 A fuzzy subset of X is called normal if there exists at least one element xX such that A(x) = 1.

 A fuzzy subset that is not normal is called subnormal.

 All crisp subsets except for the null set are normal. In fuzzy set theory, the concept of nullness
essentially generalises to subnormality.

 The height of a fuzzy subset A is the large membership grade of an element in A


height(A) = maxx(A(x))
FUZZY SETS CORE AND SUPPORT

 Assume A is a fuzzy subset of X:

 the support of A is the crisp subset of X consisting of all elements with membership grade:

supp(A) = {x A(x)  0 and xX}

 the core of A is the crisp subset of X consisting of all elements with membership grade:

core(A) = {x A(x) = 1 and xX}


FUZZY SET MATH OPERATIONS

 aA = {aA(x), xX}
Let a =0.5, and
A = {0.5/a, 0.3/b, 0.2/c, 1/d}
then
Aa = {0.25/a, 0.15/b, 0.1/c, 0.5/d}

 Aa = {A(x)a, xX}
Let a =2, and
A = {0.5/a, 0.3/b, 0.2/c, 1/d}
then
Aa = {0.25/a, 0.09/b, 0.04/c, 1/d}
FUZZY SETS EXAMPLES

 Consider two fuzzy subsets of the set X,

X = {a, b, c, d, e }

referred to as A and B

A = {1/a, 0.3/b, 0.2/c 0.8/d, 0/e}


and
B = {0.6/a, 0.9/b, 0.1/c, 0.3/d, 0.2/e}
FUZZY SETS EXAMPLES
 Support:  Complement:  aA:
supp(A) = {a, b, c, d } for a=0.5
A = {1/a, 0.3/b, 0.2/c 0.8/d, 0/e}
aA = {0.5/a, 0.15/b, 0.1/c, 0.4/d, 0/e}
supp(B) = {a, b, c, d, e }
A = {0/a, 0.7/b, 0.8/c 0.2/d, 1/e}

 Aa:
 Core: for a=2
 Union: Aa = {1/a, 0.09/b, 0.04/c, 0.64/d, 0/e}
core(A) = {a}
A  B = {1/a, 0.9/b, 0.2/c, 0.8/d, 0.2/e}
core(B) = {o}
 a-cut:
A0.2 = {a, b, c, d}
 Cardinality:  Intersection:
A0.3 = {a, b, d}
card(A) = 1+0.3+0.2+0.8+0 = 2.3 A  B = {0.6/a, 0.3/b, 0.1/c, 0.3/d, 0/e}
A0.8 = {a, d}
card(B) = 0.6+0.9+0.1+0.3+0.2 = 2.1
A1 = {a}
FUZZY RULES

 In 1973, Lotfi Zadeh published his second most influential paper. This paper outlined a new
approach to analysis of complex systems, in which Zadeh suggested capturing human knowledge
in fuzzy rules.
 A fuzzy rule can be defined as a conditional statement in the form:

IF x is A
THEN y is B
where x and y are linguistic variables; and A and B are linguistic values determined by fuzzy sets on
the universe of discourses X and Y, respectively.
CLASSICAL VS FUZZY RULES

 A classical IF-THEN rule uses binary logic, for example,

Rule: 1 Rule: 2
IF speed is > 100 IF speed is < 40
THEN stopping_distance is long THEN stopping_distance is short

 The variable speed can have any numerical value between 0 and 220 km/h, but the linguistic
variable stopping_distance can take either value long or short. In other words, classical rules are
expressed in the black-and-white language of Boolean logic.
CLASSICAL VS FUZZY RULES

 We can also represent the stopping distance rules in a fuzzy form:

Rule: 1 Rule: 2
IF speed is fast IF speed is slow
THEN stopping_distance is long THEN stopping_distance is short

 In fuzzy rules, the linguistic variable speed also has the range (the universe of discourse) between
0 and 220 km/h, but this range includes fuzzy sets, such as slow, medium and fast. The universe
of discourse of the linguistic variable stopping_distance can be between 0 and 300 m and may
include such fuzzy sets as short, medium and long.
FIRING FUZZY RULES

 Fuzzy rules relate fuzzy sets.


Degree of Degree of
Membership Membership
1.0 1.0
 In a fuzzy system, all rules fire to some extent, or in
other words they fire partially. If the antecedent is Tall men Heavy men
0.8 0.8
true to some degree of membership, then the
consequent is also true to that same degree. 0.6 0.6
 These fuzzy sets provide the basis for a weight 0.4 0.4
estimation model. The model is based on a
0.2 0.2
relationship between a man’s height and his weight:
0.0 0.0
IF height is tall 160 180 190 200 70 80 100 120
THEN weight is heavy Height, cm Weight, kg
FIRING FUZZY RULES
 The value of the output or a truth membership grade of the rule consequent can be estimated
directly from a corresponding truth membership grade in the antecedent. This form of fuzzy
inference uses a method called monotonic selection.
Degree of Degree of
Membership Membership
1.0 1.0
Tall men
0.8 0.8 Heavy men
0.6 0.6

0.4 0.4

0.2 0.2

0.0 0.0
160 180 190 200 70 80 100 120
Height, cm Weight, kg
FIRING FUZZY RULES

 A fuzzy rule can have multiple antecedents, for example:


IF project_duration is long
AND project_staffing is large
AND project_funding is inadequate
THEN risk is high

IF service is excellent
OR food is delicious
THEN tip is generous

 The consequent of a fuzzy rule can also include multiple parts, for instance:
IF temperature is hot
THEN hot_water is reduced;
cold_water is increased
FUZZY SETS EXAMPLE

 Air-conditioning involves the delivery of air which can be warmed or cooled and have its humidity raised
or lowered.

 An air-conditioner is an apparatus for controlling, especially lowering, the temperature and humidity of
an enclosed space. An air-conditioner typically has a fan which blows/cools/circulates fresh air and has
cooler and the cooler is under thermostatic control. Generally, the amount of air being compressed is
proportional to the ambient temperature.

 Consider Johnny’s air-conditioner which has five control switches: COLD, COOL, PLEASANT, WARM and
HOT. The corresponding speeds of the motor controlling the fan on the air-conditioner has the
graduations: MINIMAL, SLOW, MEDIUM, FAST and BLAST.
FUZZY SETS EXAMPLE

 The rules governing the air-conditioner are as follows:

RULE 1:
IF TEMP is COLD THEN SPEED is MINIMAL

RULE 2:
IF TEMP is COOL THEN SPEED is SLOW

RULE 3:
IF TEMP is PLEASANT THEN SPEED is MEDIUM

RULE 4:
IF TEMP is WARM THEN SPEED is FAST

RULE 5:
IF TEMP is HOT THEN SPEED is BLAST
FUZZY SETS EXAMPLE
Temp COLD COOL PLEASANT WARM HOT
(0C).
The temperature graduations are related to Johnny’s
perception of ambient temperatures. 0 Y* N N N N

5 Y Y N N N

10 N Y N N N
where:
12.5 N Y* N N N
Y : temp value belongs to the set (0<A(x)<1)
15 N Y N N N

17.5 N N Y* N N

Y* : temp value is the ideal member to the set 20 N N N Y N


(A(x)=1) 22.5 N N N Y* N

25 N N N Y N

N : temp value is not a member of the set (A(x)=0) 27.5 N N N N Y

30 N N N N Y*
FUZZY SETS EXAMPLE
Rev/sec MINIMAL SLOW MEDIUM FAST BLAST
Johnny’s perception of the speed of the motor is as (RPM)

follows: 0 Y* N N N N

10 Y N N N N

20 Y Y N N N
where: 30 N Y* N N N

Y : speed value belongs to the set (0<A(x)<1) 40 N Y N N N

50 N N Y* N N

60 N N N Y N
Y* : speed value is the ideal member to the set 70 N N N Y* N
(A(x)=1) 80 N N N Y Y

90 N N N N Y

N : speed value is not a member of the set (A(x)=0) 100 N N N N Y*


FUZZY SETS EXAMPLE

 The analytically expressed membership for the reference fuzzy subsets for the temperature are:

 COLD:
for 0 ≤ t ≤ 10 COLD(t) = – t / 10 + 1

 COOL:
for 0 ≤ t ≤ 12.5 COOL(t) = t / 12.5
for 12.5 ≤ t ≤ 17.5 COOL(t) = – t / 5 + 3.5

 etc… all based on the linear equation:


y = ax + b
FUZZY SETS EXAMPLE
Temperature Fuzzy Sets

1
0.9
0.8 Cold
Truth Value

0.7
0.6 Cool
0.5 Pleasent
0.4
0.3
Warm
0.2 Hot
0.1
0
0 5 10 15 20 25 30

Temperature Degrees C
FUZZY SETS EXAMPLE

 The analytically expressed membership for the reference fuzzy subsets for the speed are:

 MINIMAL:
for 0 ≤ v ≤ 30 MINIMAL(t) = – v / 30 + 1

 SLOW:
for 10 ≤ v ≤ 30 SLOW(t) = v / 20 – 0.5
for 30 ≤ v ≤ 50 SLOW(t) = – v / 20 + 2.5

 etc… all based on the linear equation:


y = ax + b
FUZZY SETS EXAMPLE
Speed Fuzzy Sets

1
0.8 MINIMAL
Truth Value

0.6 SLOW
MEDIUM
0.4
FAST
0.2 BLAST
0
0 10 20 30 40 50 60 70 80 90 100
Speed
EXERCISES

For
A = {0.2/a, 0.4/b, 1/c, 0.8/d, 0/e}
B = {0/a, 0.9/b, 0.3/c, 0.2/d, 0.1/e}

Draw the Fuzzy Graph of A and B

Then, calculate the following:


- Support, Core, Cardinality, and Complement for A and B independently
- Union and Intersection of A and B
- the new set C, if C = A2
- the new set D, if D = 0.5B
- the new set E, for an alpha cut at A0.5
SOLUTIONS

A = {0.2/a, 0.4/b, 1/c, 0.8/d, 0/e} A = {0.2/a, 0.4/b, 1/c, 0.8/d, 0/e}
B = {0/a, 0.9/b, 0.3/c, 0.2/d, 0.1/e} B = {0/a, 0.9/b, 0.3/c, 0.2/d, 0.1/e}

Support Union
Supp(A) = {a, b, c, d}
A B = {0.2/a, 0.9/b, 1/c, 0.8/d, 0.1/e}
Supp(B) = {b, c, d, e}
Intersection
Core A B = {0/a, 0.4/b, 0.3/c, 0.2/d, 0/e}
Core(A) = {c}
Core(B) = {}
C=A2
Cardinality C = {0.04/a, 0.16/b, 1/c, 0.64/d, 0/e}
Card(A) = 0.2 + 0.4 + 1 + 0.8 + 0 = 2.4
Card(B) = 0 + 0.9 + 0.3 + 0.2 + 0.1 = 1.5 D = 0.5 B
D = {0/a, 0.45/b, 0.15/c, 0.1/d, 0.05/e}
Complement
Comp(A) = {0.8/a, 0.6/b, 0/c, 0.2/d, 1/e}
E = A0.5
Comp(B) = {1/a, 0.1/b, 0.7/c, 0.8/d, 0.9/e}
E = {c, d}
OPERATION OF FUZZY SYSTEM

Crisp Input

Fuzzification Input Membership


Functions
Fuzzy Input

Rule Evaluation Rules / Inferences

Fuzzy Output
Defuzzification Output Membership
Functions
Crisp Output
FUZZY INFERENCE

 The Mamdani-style fuzzy inference process is


performed in four steps:
 The most commonly used fuzzy inference technique
is the so-called Mamdani method. 1. Fuzzification of the input variables

 In 1975, Professor Ebrahim Mamdani of London 2. Rule evaluation (inference)


University built one of the first fuzzy systems to
control a steam engine and boiler combination. He
applied a set of fuzzy rules supplied by experienced 3. Aggregation of the rule outputs (composition)
human operators.

4. Defuzzification.
MAMDANI FUZZY INFERENCE

We examine a simple two-input one-output problem that includes three rules:

Rule: 1 Rule: 1
IF x is A3 IF project_funding is adequate
OR y is B1 OR project_staffing is small
THENz is C1 THENrisk is low

Rule: 2 Rule: 2
IF x is A2 IF project_funding is marginal
AND y is B2 AND project_staffing is large
THENz is C2 THENrisk is normal

Rule: 3 Rule: 3
IF x is A1 IF project_funding is inadequate
THEN z is C3 THENrisk is high
STEP 1: FUZZIFICATION

 The first step is to take the crisp inputs, x1 and y1 (project funding and project staffing), and
determine the degree to which these inputs belong to each of the appropriate fuzzy sets.
Crisp Input Crisp Input
x1 y1

1 1 B1 B2
A1 A2 A3 0.7
0.5
0.2 0.1
0 0
x1 X y1 Y
 (x = A1) = 0.5  (y = B1) = 0.1
 (x = A2) = 0.2  (y = B2) = 0.7
STEP 2: RULE EVALUATION

 The second step is to take the fuzzified inputs, (x=A1) = 0.5, (x=A2) = 0.2, (y=B1) = 0.1 and (y=B2) = 0.7, and
apply them to the antecedents of the fuzzy rules.

 If a given fuzzy rule has multiple antecedents, the fuzzy operator (AND or OR) is used to obtain a single number that
represents the result of the antecedent evaluation.

 This number (the truth value) is then applied to the consequent membership function.
STEP 2: RULE EVALUATION

RECAL:
To evaluate the disjunction of the rule antecedents, we use the OR fuzzy operation. Typically, fuzzy expert systems
make use of the classical fuzzy operation union:

AB(x) = max [A(x), B(x)]

Similarly, in order to evaluate the conjunction of the rule antecedents, we apply the AND fuzzy operation intersection:

AB(x) = min [A(x), B(x)]


STEP 2: RULE EVALUATION
1 1 1
A3 B1 C1 C2 C3
0.1 OR 0.1
0.0
(max)
0 x1 X 0 y1 Y 0 Z

Rule 1: IF x is A3 (0.0) OR y is B1 (0.1) THEN z is C1 (0.1)


1 1 1
0.7
C1 C2 C3
A2 0.2 B2 AND 0.2
(min)
0 x1 X 0 y1 Y 0 Z
Rule 2: IF x is A2 (0.2) AND y is B2 (0.7) THEN z is C2 (0.2)
1 1
A1 0.5 0.5 C1 C2 C3

0 x1 X 0 Z
Rule 3: IF x is A1 (0.5) THEN z is C3 (0.5)
STEP 2: RULE EVALUATION

 Now the result of the antecedent evaluation can be applied to the membership function of the consequent.

 There are two main methods for doing so:


 Clipping
 Scaling
STEP 2: RULE EVALUATION

 The most common method of correlating the rule consequent with the truth value of the rule antecedent is to cut
the consequent membership function at the level of the antecedent truth. This method is called clipping (alpha-
cut).

 Since the top of the membership function is sliced, the clipped fuzzy set loses some information.

 However, clipping is still often preferred because it involves less complex and faster mathematics, and generates
an aggregated output surface that is easier to defuzzify.
STEP 2: RULE EVALUATION

 While clipping is a frequently used method, scaling offers a better approach for preserving the original shape of the
fuzzy set.

 The original membership function of the rule consequent is adjusted by multiplying all its membership degrees by
the truth value of the rule antecedent.

 This method, which generally loses less information, can be very useful in fuzzy expert systems.
STEP 2: RULE EVALUATION

Degree of Degree of
Membership Membership
1.0 1.0

C2 C2

0.2 0.2

0.0 0.0
Z Z
clipping scaling
STEP 3: AGGREGATION OF THE RULE OUTPUTS
 Aggregation is the process of unification of the outputs of all rules.

 We take the membership functions of all rule consequents previously clipped or scaled and combine them into a
single fuzzy set.
 The input of the aggregation process is the list of clipped or scaled consequent membership functions, and the
output is one fuzzy set for each output variable.

1 1 1
C1 C2 C3
0.5 0.5
0.2 0.2
0.1 0.1
0 Z 0 Z 0 Z 0 Z
z is C 1 (0.1) z is C 2 (0.2) z is C 3 (0.5) 
STEP 4: DEFUZZIFICATION

 The last step in the fuzzy inference process is defuzzification.

 Fuzziness helps us to evaluate the rules, but the final output of a fuzzy system has to be a crisp number.

 The input for the defuzzification process is the aggregate output fuzzy set and the output is a single number.

 There are several defuzzification methods, but probably the most popular one is the centroid technique. It finds the
point where a vertical line would slice the aggregate set into two equal masses. Mathematically this centre of
gravity (COG) can be expressed as: b
  A (x ) x dx
COG = a
b
  A (x ) dx
a
STEP 4: DEFUZZIFICATION

 Centroid defuzzification method finds a point representing the centre of gravity of the fuzzy set, A, on the
interval, ab.
 A reasonable estimate can be obtained by calculating it over a sample of points.

(x)
1.0
0.8

0.6 A

0.4

0.2
a b
0.0 X
150 160 170 180 190 200 210
STEP 4: DEFUZZIFICATION
Degree of
Membership
1.0

0.8

0.6

0.4

0.2

0.0
0 10 20 30 40 50 60 70 80 90 100
67.4 Z

(0 + 10 + 20)  0.1 + (30 + 40 + 50 + 60)  0.2 + (70 + 80 + 90 + 100)  0.5


COG = = 67.4
0.1 + 0.1 + 0.1 + 0.2 + 0.2 + 0.2 + 0.2 + 0.5 + 0.5 + 0.5 + 0.5
SUGENO FUZZY INFERENCE

 Mamdani-style inference, as we have just seen, requires us to find the centroid of a two-dimensional shape by
integrating across a continuously varying function. In general, this process is not computationally efficient.

 Michio Sugeno suggested to use a single spike, a singleton, as the membership function of the rule consequent.

 A singleton, or more precisely a fuzzy singleton, is a fuzzy set with a membership function that is unity at a single
particular point on the universe of discourse and zero everywhere else.
SUGENO FUZZY INFERENCE

 Sugeno-style fuzzy inference is very similar to the Mamdani method. Sugeno changed only a rule consequent.
Instead of a fuzzy set, he used a mathematical function of the input variable. The format of the Sugeno-style fuzzy
rule is

IF x is A
AND y is B
THEN z is f(x, y)

where x, y and z are linguistic variables; A and B are fuzzy sets on universe of discourses X and Y, respectively; and
f(x, y) is a mathematical function.
SUGENO FUZZY INFERENCE

 The most commonly used zero-order Sugeno fuzzy model applies fuzzy rules in the following form:

IF x is A
AND y is B
THEN z is k

where k is a constant.

 In this case, the output of each fuzzy rule is constant. All consequent membership functions are represented by
singleton spikes.
SUGENO RULE EVALUATION
1 1 1
A3 B1
0.1 OR 0.1
0.0
(max)
0 x1 X 0 y1 Y 0 k1 Z

Rule 1: IF x is A3 (0.0) OR y is B1 (0.1) THEN z is k1 (0.1)


1 1 1
0.7
A2 0.2 B2 AND 0.2
(min)
0 x1 X 0 y1 Y 0 k2 Z
Rule 2: IF x is A2 (0.2) AND y is B2 (0.7) THEN z is k2 (0.2)
1 1
A1 0.5 0.5

0 x1 X 0 k3 Z
Rule 3: IF x is A1 (0.5) THEN z is k3 (0.5)
SUGENO AGGREGATION OF THE RULE OUTPUTS

1 1 1 1
0.5 0.5
0.2
0.1 0.2 0.1
0 k1 Z 0 k2 Z 0 k3 Z 0 k1 k2 k3 Z

z is k1 (0.1) z is k2 (0.2) z is k3 (0.5) 


SUGENO DEFUZZIFICATION
Weighted Average (WA)

(k1)  k1 + (k 2)  k 2 + (k 3)  k 3 0.1 20 + 0.2  50 + 0.5  80


WA = = = 65
(k1) + (k 2) + (k 3) 0.1 + 0.2 + 0.5

0 z1 Z

Crisp Output
z1
MAMDANI OR SUGENO?

 Mamdani method is widely accepted for capturing expert knowledge. It allows us to describe the expertise in more
intuitive, more human-like manner. However, Mamdani-type fuzzy inference entails a substantial computational
burden.

 On the other hand, Sugeno method is computationally effective and works well with optimisation and adaptive
techniques, which makes it very attractive in control problems, particularly for dynamic nonlinear systems.
CONCLUSION
RECOMMENDED READINGS

 Genetic fuzzy systems by Oscar Cordón, Francisco Herrera, Frank Hoffmann

 Neural Network and Fuzzy Logic Applications in C/C++ (Wiley Professional Computing) by Stephen Welstead

 Fuzzy Logic with Engineering Applications by Timothy Ross

 Fuzzy Sets and Pattern Recognition by Benjamin Knapp


ASSIGNMENTS

 Define Sugeno inference method. What is the difference between Sugeno and Mamdani? And which one is
better?
 Implement a fuzzy logic controller in a specific application with defining the fuzzy rules, linguistic variables
and hedges, fuzzy graphs, etc.. and finally record its results.

You might also like