Fuzzy Inference Systems

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 56

Fuzzy Inference Systems

Fuzzy Inference Systems


Fuzzy inference (reasoning) is the actual
process of mapping from a given input to an
output using fuzzy logic.

The process involves all the pieces that we


have discussed in the previous sections:
membership functions, fuzzy logic operators,
and if-then rules
Fuzzy Inference Systems
Fuzzy inference systems have been successfully applied in fields
such as automatic control, data classification, decision analysis,
expert systems, and computer vision.

Because of its multi-disciplinary nature, the fuzzy inference


system is known by a number of names, such as
fuzzy-rule-based system,
fuzzy expert system,
fuzzy model,
fuzzy associative memory,
fuzzy logic controller,
and simply fuzzy system.
Fuzzy Inference Systems
The Architecture of
Fuzzy Inference Systems

Inference
Input Fuzzifier Defuzzifier Output
Engine

Fuzzy
Knowledge base
Fuzzy Inference Systems Inference
Input Fuzzifier Defuzzifier Output
Engine

Fuzzy
Knowledge base

The steps of fuzzy reasoning (inference operations upon fuzzy IF–THEN rules)
performed by FISs are:
1. Fuzzification: Compare the input variables with the membership functions on the
antecedent part to obtain the membership values of each linguistic label. (this
step is often called fuzzification.)

2. Rule evaluation: Combine (usually multiplication or min) the membership values


on the premise part to get firing strength (deree of fullfillment) of each rule.

3. Rule aggregation: Generate the qualified consequents (either fuzzy or crisp) or


each rule depending on the firing strength.

4. Defuzzification: Aggregate the qualified consequents to produce a crisp output.


(This step is called defuzzification.)
Fuzzy Knowledge Base
Inference
Input Fuzzifier Defuzzifier Output
Engine

Fuzzy
Knowledge base

The rule base and the database are jointly referred to as the knowledge
base.
•a rule base containing a number of fuzzy IF–THEN rules;
•a database which defines the membership functions of the fuzzy sets
used in the fuzzy rules
Fuzzifier
Inference
Input Fuzzifier Defuzzifier Output
Engine

Fuzzy
Knowledge base

Converts the crisp input to a linguistic variable using


the membership functions stored in the fuzzy
knowledge base.
Inference

Inference Engine
Input Fuzzifier Defuzzifier Output
Engine

Fuzzy
Knowledge base

Using If-Then type fuzzy rules converts the fuzzy


input to the fuzzy output.
Defuzzifier
Inference
Input Fuzzifier Defuzzifier Output
Engine

Fuzzy
Knowledge base

Converts the fuzzy output of the inference engine


to crisp using membership functions analogous to
the ones used by the fuzzifier.
Defuzzifier
Inference
Input Fuzzifier Defuzzifier Output
Engine

Fuzzy
Knowledge base

• Converts the fuzzy output of the inference


engine to crisp using membership functions
analogous to the ones used by the fuzzifier.
Defuzzification
Defuzzification
Maxima method
Maxima method : Height method
Centre of Area
Mean of Maxima
Weighted Average
Defuzzification-Example1
Find crisp output of following membership function:
Centroid method:
Example-2
Example-3
Operation of Fuzzy System
Crisp Input

Fuzzification Input Membership Functions

Fuzzy Input

Rule Evaluation Rules / Inferences


and aggregation
Fuzzy Output

Defuzzification Output Membership Functions

Crisp Output
Fuzzy Inference Methods
The most important two types of fuzzy inference
method are Mamdani and Sugeno fuzzy inference
methods,
Mamdani fuzzy inference is the most commonly seen
inference method. This method was introduced by
Mamdani and Assilian (1975).

Another well-known inference method is the so- called


Sugeno or Takagi–Sugeno–Kang method of fuzzy
inference process. This method was introduced by
Sugeno (1985). This method is also called as TS method.

The main difference between the two methods lies in


the consequent of fuzzy rules.
Mamdani fuzzy inference
The Mamdani-style fuzzy inference process is performed
in four steps:
1. Fuzzification of the input variables,

2. Rule evaluation;

3. Aaggregation of the rule outputs, and finally

4. Defuzzification.
Mamdani fuzzy inference
The Reasoning Scheme
Max-Min Composition is used.
Mamdani fuzzy inference
The Reasoning Scheme
Max-Product Composition is used.
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
THEN z is C1 THEN risk is low
Rule: 2 Rule: 2
IF x is A2 IF project_funding is marginal
AND y is B2 AND project_staffing is large
THEN z is C2 THEN risk is normal
Rule: 3 Rule: 3
IF x is A1 IF project_funding is inadequate
THEN z is C3 THEN risk is high
Mamdani fuzzy inference
Step 1: Fuzzification
■ Take the crisp inputs, x1 and y1 (project funding and
project staffing)
■ Determine the degree to which these inputs belong
to each of the appropriate fuzzy sets.
Mamdani fuzzy inference
Step 2: Rule Evaluation
• take the fuzzified inputs, (x=A1) = 0.5, (x=A2) = 0.2,
(y=B1) = 0.1 and (y=B2) = 0.7

• apply them to the premise of the fuzzy rules.

• If a given fuzzy rule has multiple premise (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.
Mamdani fuzzy inference
Step 2: Rule Evaluation

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)]
Mamdani fuzzy inference
Step 2: Rule Evaluation
Mamdani-style rule evaluation
• Now the result of the Premise evaluation can be
applied to the membership function of the
consequent.
• The most common method is to cut the consequent
membership function at the level of the antecedent
truth.
• This method is called clipping (Max-Min Composition) .
• The clipped fuzzy set loses some information.
• Clipping is still often preferred because:
• it involves less complex and faster mathematics
• it generates an aggregated output surface that is
easier to defuzzify.
 While clipping is a frequently used method, scaling
(Max-Product Composition) 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.
Clipped and scaled membership functions
Mamdani fuzzy inference
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.
Mamdani fuzzy inference

Step 3: Aggregation of The Rule Outputs

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) 
Mamdani fuzzy inference

Step 4: 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


aggregated 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

  x  x dx
A

COG  a
b

  x  dx
a
A
Mamdani fuzzy inference
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 Models
• Also known as TSK fuzzy model
– Takagi, Sugeno & Kang

• Goal: Generation of fuzzy rules from a given input-output data


set.
• In Sugeno’s model, each rule has a crisp output, the overall
input is obtained by a weighted average – this avoids the
time-consuming process of defuzzification required in a
Mamdani model. The weighted average operator is replaced
by a weighted sum to reduce computation further.
Fuzzy Rules of TSK Model

If x is A and y is B then z = f(x, y)

Fuzzy Sets Crisp Function

f(x, y) is very often a polynomial


function
Examples

R1: if X is small and Y is small then z = x +y +1

R2: if X is small and Y is large then z = y +3

R3: if X is large and Y is small then z = x +3

R4: if X is large and Y is large then z = x + y + 2


TSK Model: The Reasoning
Scheme
Sugeno fuzzy inference
Like Mamdani, Sugeno-style fuzzy inference process is
also perform in following steps:
1. Fuzzification of the input variables-

2. Rule evaluation

3. Defuzzification.
Sugeno fuzzy inference: Steps
Consider a system with n implications (rules); the variable of
consequence, y, will have to be notated for each of these implications,
leading to yi variables of consequence. There are three stages of
computations in Takagi-Sugeno controllers:
FUZZIFICATION: Fuzzify the input. For all input variables compute the
implication for each of the rules;
INFERENCE or CONSEQUENCES: For each implication compute the
consequence for a rule which fires. Compute the output y for the rule by
using the linear relationship between the inputs and the output (y = p0 +
p1x1 + … + pkxk.).
AGGREGATE (& DEFUZZIFICATION): The final output y is inferred
from n-implications and given as an average of all individual implications
yi with weights |y= yi |:
y = (S |y= yi | * yi )/ S |y= yi |
Sugeno fuzzy inference: Example

Consider the following fuzzy implications (or rules) R1,R2,


R3 used in the design of a Takagi-Sugeno controller:

R1  If x1 is small1 & x2 is small2 then y(1) =x1+x2


R2 If x1 is big1 then y(2) = 2x1
R3 If x2 is big2 then y(3) =3x2

where y (i) refers to the consequent variable for each rule


labelled Ri and x1 and x2 refer to the input variables that
appear in premise of the rules.
The membership function for small1, small2, big1 and big2 are
given as follows
x Small1 Small2 Big1 Big2
0 1 1 0 0
1 0.938 0.875 0 0
2 0.875 0.75 0 0
3 0.813 0.625 0 0.125
4 0.75 0.5 0 0.25
5 0.688 0.375 0 0.375
6 0.625 0.25 0 0.5
7 0.563 0.125 0 0.625
8 0.5 0 0 0.75
9 0.438 0 0 0.875
10 0.375 0 0 1
11 0.313 0 0.1 1
12 0.25 0 0.2 1
13 0.188 0 0.3 1
14 0.125 0 0.4 1
15 0.063 0 0.5 1
16 0 0 0.6 1
17 0 0 0.7 1
18 0 0 0.8 1
19 0 0 0.9 1
20 0 0 1 1
Let us compute the FINAL OUTPUT y for the following
values:
x1 = 12 & x2 = 5
using Takagi and Sugeno’s formula:
y = (S |y= yi | * yi )/ S |y= yi |
where |y= yi | stands for the truth value of a given proposition.
FUZZUFICATION: We have the following values of the
membership functions for the two values x1 = 12 & x2 = 5:

Small1 Small2 Big1 Big2


x 1= 12 0.25 0 0.2 1
x 2= 5 0.688 0.375 0 0.375
INFERENCE & CONSEQUENCE:
x1 = 12 & x2 = 5

Truth Value
Min (Premise 1 &
Rule Premise 1 Premise 2 Consequenc Premise2)
e

R1 Small1 ( x1 ) = Small2 ( x2 )= y(1)= x1 + x2 Min(0.25,


0.25 0.375 =12+5=17 0.375)=0.25

R2 Big1 ( x1 ) = y(2)= 2x1 0.2


0.2 = 24

R3 Big2 ( x2 ) = y(3)= 3x2 0.375


0.375 = 15
AGGREGATION (&DEFUZZIFICATION):
x1 = 12 & x2 = 5
y = (S |y= yi | * yi )/ S |y= yi |
Using a Centre of Area computation for y we get:

 y  y (i ) * y (i )
i 1,3
y 
 y  y (i )
i 1,3
0.25 *17  0.2 * 24  0.375 *15
y   17.8
0.25  0.2  0.375
In Sugeno’s model, each rule has a crisp output, the
overall input is obtained by a weighted average – this
avoids the time-consuming process of defuzzification
required in a Mamdani model. The weighted
average operator is replaced by a weighted sum to
reduce computation further.

You might also like