Module 5-1
Module 5-1
Hedges modify the shape of a fuzzy set. Truth tables define logic functions of two propositions. Let X and Y be
two propositions, either of which can be true or false.
2. Disjunction (): X OR Y.
FUZZY PREPOSITIONS
FUZZY PREPOSITIONS
• Reasoning has logic as its basis, whereas prepositions
are text sentences expressed in any language
• Generally expressed in an canonical form as For extending reasoning capacity fuzzy logic uses
z is P fuzzy predicates, fuzzy predicate modifies fuzzy
• Z is Subject quantifiers and fuzzy qualifiers in the fuzzy
• P is predicate prepositions
• E a ple Lo do is i U ited Ki gdo The fuzzy prepositions make the fuzzy logic
• Lo do is su je t a d i u ited Ki gdo is differ from the classical logic
predicate The fuzzy prepositions are as follows
• Every preposition has its opposite called negation
Here the fuzzy classes height and weight have a given range (i.e., the
universe of discourse).
Conditional Statements
Rule 3: If height is tall then weight is heavy. (2) Each rule produces a fuzzy set as output by truncating the
consequent membership function at the value of the antecedent
membership.
1. Categorical reasoning,
2. Qualitative reasoning,
3. Syllogistic reasoning,
4. Dispositional reasoning.
Syllogistic Reasoning
• In this reasoning antecedents with fuzzy quantifiers
are related to inference rules
• A fuzzy syllogism can be expressed as follows
X= k A’s a e B’s
Y=k C’s a e D’s
then
Z=k E’s a e F’s
Two input single-output Mamdani fuzzy model with 4 rules: Two-input single output fuzzy model with 4 rules
If X is small & Y is small then Z is negative large R1: if X is small & Y is small then z = -x +y +1
If X is small & Y is large then Z is negative small R2: if X is small & Y is large then z = -y +3
If X is large & Y is small then Z is positive small R3: if X is large & Y is small then z = -x +3
If X is large & Y is large then Z is positive large R4: if X is large & Y is large then z = x + y + 2
X = [-5, 5]; Y = [-5, 5]; Z = [-5, 5]
The consequence of a fuzzy rule is computed using • In many instances, it is desired to come up with a
two steps: single crisp output from an FIS.
1.Computing the rule strength by combining the • For example, if one was trying to classify a letter
fuzzified inputs using the fuzzy combination drawn by hand on a drawing tablet, ultimately
process discussed in previous section. the FIS would have to come up with a crisp
number to tell the computer which letter was
This is shown in Fig. 6.2.
drawn.
In this example, the fuzzy “AND” is used to
• This crisp number is obtained in a process known
combine the membership functions to compute
as Defuzzification.
the rule strength.
2. Clipping the output membership function at the
rule strength.
Arsha J K,AP,Computer Science Arsha J K,AP,Computer Science
and Engineering, VJCET, and Engineering, VJCET,
Vazhakulam Vazhakulam
Evaluate rules:
• Based on membership values of (composite) antecedents.
Genetic Algorithm
Genetic algorithms inspired by the natural evolution process are
adaptive search and optimization algorithms.
On the contrary, fuzzy logic is good at explaining the decisions but neuron genetic hybrid system;
cannot automatically acquire the rules used for making the decisions.
Also, the tuning of membership functions becomes an important issue fuzzy genetic hybrid systems.
in fuzzy modeling. Genetic algorithms offer a possibility to solve this
problem.
A neuro-fuzzy hybrid system (also called fuzzy neural hybrid) is a 1. Cooperative NFSs.
learning mechanism that utilizes the training and learning algorithms
from neural networks to find parameters of a fuzzy system. 2. General neuro-fuzzy hybrid systems.
Fig 1
Fig 2
Arsha J K,AP,Computer Science
and Engineering, VJCET,
Vazhakulam 11/23/2017 Intelligent Systems and Soft Computing 2
n Summary l defuzzification.
11/23/2017 Intelligent Systems and Soft Computing 1 11/23/2017 Intelligent Systems and Soft Computing 3
We examine a simple two-input one-output problem that Step 2: Rule Evaluation
includes three rules:
The second step is to take the fuzzified inputs,
Rule: 1 Rule: 1
IF x is A3 IF project_funding is adequate
(x=A1) = 0.5, (x=A2) = 0.2, (y=B1) = 0.1 and (y=B 2) =
OR y is B1 OR project_staffing is small 0.7, and apply them to the antecedents of the fuzzy
THEN z is C1 THEN risk is low rules. If a given fuzzy rule has multiple antecedents,
Rule: 2 Rule: 2 the fuzzy operator (AND or OR) is used to obtain a
IF x is A2 IF project_funding is marginal single number that represents the result of the
AND y is B2 AND project_staffing is large antecedent evaluation. This number (the truth value)
THEN z is C2 THEN risk is normal
is then applied to the consequent membership
Rule: 3 Rule: 3 function.
IF x is A1 IF project_funding is inadequate
THEN z is C3 THEN risk is high
11/23/2017 Intelligent Systems and Soft Computing 4 11/23/2017 Intelligent Systems and Soft Computing 6
11/23/2017 Intelligent Systems and Soft Computing 5 11/23/2017 Intelligent Systems and Soft Computing 7
Mamdani-style rule evaluation n While clipping is a frequently used method, scaling
1 1 1
offers a better approach for preserving the original
A3 B1
0.1 0.1
C1 C2 C3 shape of the fuzzy set. The original membership
0.0 OR
0 x1 X 0 y1 Y
(max)
0 Z
function of the rule consequent is adjusted by
Rule 1: IF x is A3 (0.0) OR y is B1 (0.1) THEN z is C1 (0.1)
multiplying all its membership degrees by the truth
1 1 1 value of the rule antecedent. This method, which
0.7
A2 0.2 B2 AND 0.2
C1 C2 C3 generally loses less information, can be very useful
(min)
0 x1 X 0 y1 Y 0 Z in fuzzy expert systems.
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)
11/23/2017 Intelligent Systems and Soft Computing 8 11/23/2017 Intelligent Systems and Soft Computing 10
Now the result of the antecedent evaluation can be Clipped and scaled membership functions
applied to the membership function of the
consequent.
Degree of Degree of
n The most common method of correlating the rule Membership Membership
1.0 1.0
consequent with the truth value of the rule
antecedent is to cut the consequent membership C2 C2
function at the level of the antecedent truth. This
method is called clipping. Since the top of the 0.2 0.2
membership function is sliced, the clipped fuzzy set
0.0 0.0
loses some information. However, clipping is still Z Z
often preferred because it involves less complex and
faster mathematics, and generates an aggregated
output surface that is easier to defuzzify.
11/23/2017 Intelligent Systems and Soft Computing 9 11/23/2017 Intelligent Systems and Soft Computing 11
Step 3: Aggregation of the rule outputs Step 4: Defuzzification
Aggregation is the process of unification of the The last step in the fuzzy inference process is
outputs of all rules. We take the membership defuzzification. Fuzziness helps us to evaluate the
functions of all rule consequents previously clipped or rules, but the final output of a fuzzy system has to be
scaled and combine them into a single fuzzy set. a crisp number. The input for the defuzzification
process is the aggregate output fuzzy set and the
The input of the aggregation process is the list of
output is a single number.
clipped or scaled consequent membership functions,
and the output is one fuzzy set for each output
variable.
11/23/2017 Intelligent Systems and Soft Computing 12 11/23/2017 Intelligent Systems and Soft Computing 14
Aggregation of the rule outputs n There are several defuzzification methods, but
probably the most popular one is the centroid
technique. It finds the point where a vertical line
1 1 1
would slice the aggregate set into two equal masses.
C1 C2 C3
0.5 0.5 Mathematically this centre of gravity (COG) can
0.2 0.2
0.1
0 Z 0 Z 0 Z
0.1
0 Z
be expressed as:
z is C1 (0.1) z is C2 (0.2) z is C3 (0.5)
b
A x x dx
COG a
b
A x dx
a
11/23/2017 Intelligent Systems and Soft Computing 13 11/23/2017 Intelligent Systems and Soft Computing 15
n Centroid defuzzification method finds a point Sugeno fuzzy inference
representing the centre of gravity of the fuzzy set, A,
on the interval, ab. n Mamdani-style inference, as we have just seen,
n A reasonable estimate can be obtained by calculating requires us to find the centroid of a two-dimensional
it over a sample of points. shape by integrating across a continuously varying
function. In general, this process is not
1.0 computationally efficient.
0.8
n Michio Sugeno suggested to use a single spike, a
0.6 A
singleton, as the membership function of the rule
0.4 consequent. A singleton,, or more precisely a fuzzy
0.2 singleton, is a fuzzy set with a membership
a b function that is unity at a single particular point on
0.0 X
150 160 170 180 190 200 210 the universe of discourse and zero everywhere else.
11/23/2017 Intelligent Systems and Soft Computing 16 11/23/2017 Intelligent Systems and Soft Computing 18
11/23/2017 Intelligent Systems and Soft Computing 17 11/23/2017 Intelligent Systems and Soft Computing 19
The most commonly used zero-order Sugeno fuzzy Sugeno-style aggregation of the rule outputs
model applies fuzzy rules in the following form:
IF x is A 1 1 1 1
AND y is B 0.5 0.5
0.2
0.1 0.2 0.1
THEN z is k 0 k1 Z 0 k2 Z 0 k3 Z 0 k1 k2 k3 Z
11/23/2017 Intelligent Systems and Soft Computing 20 11/23/2017 Intelligent Systems and Soft Computing 22
Crisp Output
0 x1 X 0 k3 Z z1
Rule 3: IF x is A1 (0.5) THEN z is k3 (0.5)
11/23/2017 Intelligent Systems and Soft Computing 21 11/23/2017 Intelligent Systems and Soft Computing 23
How to make a decision on which method
to apply – Mamdani or Sugeno?
n 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.
Single input single output antecedent & consequent MFs
n 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.
11/23/2017 Intelligent Systems and Soft Computing 24 11/23/2017 Overall
Intelligentinput-output
Systems26
and Soft Computing curve
More Examples for Mamdani Fuzzy Models Example #2 (Mamdani Fuzzy models )
Example #1 Two input single-output Mamdani fuzzy
Single input single output Mamdani fuzzy
model with 4 rules:
model with 3 rules: If X is small & Y is small then Z is
If X is small then Y is small R1 negative large
If X is medium then Y is medium R2
If X is small & Y is large then Z is
Is X is large then Y is large R3
negative small
X = input [-10, 10] Y = output [0,10]
If X is large & Y is small then Z is
Using centroid defuzzification, we obtain
the following overall input-output positive small
curve If X is large & Y is large then Z is
positive large
11/23/2017 Intelligent Systems25
and Soft Computing 11/23/2017 Intelligent Systems27
and Soft Computing
X = [-5, 5]; Y = [-5, 5]; Z = [-5, 5] with max-min
composition & centroid defuzzification, we can More Examples for Sugeno Fuzzy Models
determine the overall input output surface
11/23/2017
Overall input-output surface
Intelligent Systems29
and Soft Computing 11/23/2017 Intelligent Systems31
and Soft Computing
However, if we have smooth membership
functions (fuzzy rules) the overall input-
output curve becomes a smoother one
Example 2:
Two-input single output fuzzy model with 4 rules
Building a fuzzy expert system: case study
n A service centre keeps spare parts and repairs failed
R1: if X is small & Y is small then z = -x +y +1
ones.
R2: if X is small & Y is large then z = -y +3
R3: if X is large & Y is small then z = -x +3 n A customer brings a failed item and receives a spare
R4: if X is large & Y is large then z = x + y + 2 of the same type.
n Failed parts are repaired, placed on the shelf, and
thus become spares.
n The objective here is to advise a manager of the
service centre on certain decision policies to keep
the customers satisfied.
11/23/2017 Intelligent Systems and Soft Computing 36 11/23/2017 Intelligent Systems and Soft Computing 38
Step 1: Specify the problem and define Step 2: Determine fuzzy sets
linguistic variables Fuzzy sets can have a variety of shapes. However,
There are four main linguistic variables: average a triangle or a trapezoid can often provide an
waiting time (mean delay) m, repair utilisation adequate representation of the expert knowledge,
factor of the service centre r (is the ratio of the and at the same time, significantly simplifies the
customer arrival day to the customer departure rate) process of computation.
number of servers s, and initial number of spare parts
n.
11/23/2017 Intelligent Systems and Soft Computing 37 11/23/2017 Intelligent Systems and Soft Computing 39
Fuzzy sets of Mean Delay m Fuzzy sets of Repair Utilisation Factor r
Degree of Degree of
Membership Membership
1.0 1.0
0.8 VS S M 0.8 L M H
0.6 0.6
0.4 0.4
0.2 0.2
0.0 0.0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Mean Delay (normalised) Repair Utilisation Factor
11/23/2017 Intelligent Systems and Soft Computing 40 11/23/2017 Intelligent Systems and Soft Computing 42
0.8 S M L 0.8 VS S RS M RL L VL
0.6 0.6
0.4 0.4
0.2 0.2
0.0 0.0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Number of Spares (normalised)
11/23/2017 Intelligent Systems and Soft Computing 41 11/23/2017 Intelligent Systems and Soft Computing 43
Step 3: Elicit and construct fuzzy rules The rule table
To accomplish this task, we might ask the expert to Rule m s r n Rule m s r n Rule m s r n
describe how the problem can be solved using the 1 VS S L VS 10 VS S M S 19 VS S H VL
fuzzy linguistic variables defined previously. 2 S S L VS 11 S S M VS 20 S S H L
3 M S L VS 12 M S M VS 21 M S H M
Required knowledge also can be collected from 4 VS M L VS 13 VS M M RS 22 VS M H M
other sources such as books, computer databases, 5 S M L VS 14 S M M S 23 S M H M
flow diagrams and observed human behavior. 6 M M L VS 15 M M M VS 24 M M H S
7 VS L L S 16 VS L M M 25 VS L H RL
The matrix form of representing fuzzy rules is called 8 S L L S 17 S L M RS 26 S L H M
fuzzy associative memory (FAM). 9 M L L VS 18 M L M S 27 M L H RS
11/23/2017 Intelligent Systems and Soft Computing 44 11/23/2017 Intelligent Systems and Soft Computing 46
VS S M m
11/23/2017 Intelligent Systems and Soft Computing 45 11/23/2017 Intelligent Systems and Soft Computing 47
Cube FAM of Rule Base 2
s
s
VS VS VS L RL M RS
Step 5: Evaluate and tune the system
VS VS VS
L S S VS
VS VS VS M M M S
M
VS VS VS
VS VS VS
The last, and the most laborious, task is to evaluate
VS VS VS r S VL L M r
S
VS VS VS
VS VS VS H VS S M
H and tune the system. We want to see whether our
M
L s fuzzy system meets the requirements specified at
VS S M m
L M RS S
m the beginning.
M RS S VS
M VS VS VS
The Fuzzy Logic Toolbox can generate surface to
S VS VS VS
help us analyze the system’s performance.
L
VS S M
m
11/23/2017 Intelligent Systems and Soft Computing 48 11/23/2017 Intelligent Systems and Soft Computing 50
Step 4: Encode the fuzzy sets, fuzzy rules Three-dimensional plots for Rule Base 1
and procedures to perform fuzzy
inference into the expert system 0.6
Knowledge Builder. 0
0.2 1
0.8
0.4 0.6
0.4
0.6 0.2
mean_delay 0 number_of_servers
11/23/2017 Intelligent Systems and Soft Computing 49 11/23/2017 Intelligent Systems and Soft Computing 51
Three-dimensional plots for Rule Base 1 Three-dimensional plots for Rule Base 2
0.5
0.6
0.4
0.5
0.3
0.4
0.3 0.2
0.2
0 0
0.2 1 0.2 1
0.8 0.8
0.4 0.6 0.4 0.6
0.4 0.4
0.6 0.2 0.6 0.2
mean_delay 0 utilisation_factor mean_delay 0 utilisation_factor
11/23/2017 Intelligent Systems and Soft Computing 52 11/23/2017 Intelligent Systems and Soft Computing 54
0.25
on the universe of discourse Number of Servers,
0.2 and then extend the rule base.
0.15
0.2 1
0.8
0.4 0.6
0.4
0.6 0.2
mean_delay 0 number_of_servers
11/23/2017 Intelligent Systems and Soft Computing 53 11/23/2017 Intelligent Systems and Soft Computing 55
Three-dimensional plots for Rule Base 3
Modified fuzzy sets of Number of Servers s
Degree of 0.35
Membership
1.0 0.3
0.8 S RS M RL L
0.25
0.6
0.2
0.4
0.2 0.15
0.0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0.2 1
Number of Servers (normalised) 0.8
0.4 0.6
0.4
0.6 0.2
mean_delay 0 number_of_servers
11/23/2017 Intelligent Systems and Soft Computing 56 11/23/2017 Intelligent Systems and Soft Computing 58
s RS S VS VS
0.2
L S S VS S S VS VS
M
RL VS S M
S S VS
m 0
M VS VS VS
0.2 1
RS VS VS VS 0.8
0.4 0.6
S VS VS VS 0.4
L 0.6 0.2
VS S M 0
mean_delay utilisation_factor
m
11/23/2017 Intelligent Systems and Soft Computing 57 11/23/2017 Intelligent Systems and Soft Computing 59
Tuning fuzzy systems
1. Review model input and output variables, and if
required redefine their ranges.
2. Review the fuzzy sets, and if required define
additional sets on the universe of discourse. The
use of wide fuzzy sets may cause the fuzzy system to
perform roughly.
3. Provide sufficient overlap between neighboring sets.
It is suggested that triangle-to-triangle and trapezoid-
to-triangle fuzzy sets should overlap between 25% to
50% of their bases.
11/23/2017 Intelligent Systems and Soft Computing 60