Вы находитесь на странице: 1из 43

‫مساق الحوسبة البرمجية‬

Soft Computing 8702661

Dr. Labib Arafeh,


Associate Professor
Larafeh@staff.alquds.edu

Ch4 SC Fall 2016 1


Fuzzy Inference Systems
• Introduction
• Mamdani Fuzzy models
• Sugeno Fuzzy Models
• Tsukamoto Fuzzy models
• Other Considerations
–Fuzzy modeling

Ch4 SC Fall 2016 2


Introduction
• Recall: Fuzzy Inference A popular computer paradigm or
framework, based on concepts of: Fuzzy Set
Theory, Fuzzy if-then rules, Fuzzy reasoning.
• Different Names (Due to its multidisciplinary
Nature): Fuzzy Expert System, Fuzzy Rule-based System,
Fuzzy Model, Fuzzy Associative Memory, Fuzzy Logic
Controller, and (Simply & ambiguously) Fuzzy System.

A Fuzzy Inference System


Fuzzy Logic

(FIS) block diagram


Inference

Ch4 SC Fall 2016 3


• Basic Structure:
– Rule base  Contains a selection of fuzzy rules,
– Database (or dictionary)  Defines the membership
functions used in the fuzzy rules,
– A reasoning mechanism  Performs the inference
procedure (Derives a reasonable conclusion / output
from facts & rules!)
– Defuzzification: Extracts a crisp value that best
represents a fuzzy set:
• Need: it might be necessary to have a crisp output in
some situations like: FIS is used as a controller.
• Three Major Components in FIS:
– Fuzzification
– Fuzzy Logic Inference
– Defuzzification.
Ch4 SC Fall 2016 4
• That is,
– Basic FIS can take: fuzzy OR crisp inputs (fuzzy singletons)
– Fuzzification is needed if the input is not fuzzy
– Outputs are always fuzzy sets.
– Defuzzification transforms O/P fuzzy set into a crisp value
• Non linearity:
– In the case of crisp inputs & outputs, a fuzzy inference
system implements a nonlinear mapping from its I/P
space to O/P space.
– Mapping is accomplished by f u z z y i f - t h e n r u l e s , each
of which describes the local behavior of the mapping
– In particular, while the a n t e c e d e n t of a rule defines a
fuzzy region in the input space, the c o n s e q u e n t
specifies the output in the fuzzy region.
Ch4 SC Fall 2016 5
Example: Fuzzy Assertions:
Decision Making
Fuzzy Statements: Buying a car
• Wife’s rule:

– Our New Car Should Seat At Least


Six People,

– Our New Car Should Be Economical.

• Husband’s rule:

– Our New Car Should Be Loaded With Extras,

– Our New Car Should Cost Around $20,000.00


Ch4 SC Fall 2016 6
C OST AROUND

$16,000 $18,000 $20,000 $22,000 $24,000 $26,000


SEDAN STATION WAGON MINI VAN FULL SIZE VAN LIMOUSINE

Decision: I f The Car Dealer Has A Sale On M i n i Va n s


T h e n Our New Car Should Be A M i n i Va n

Ch4 SC Fall 2016 7


Decision: I f The Car Dealer Has A Sale On M i n i Va n s
T h e n Our New Car Should Be A M i n i Va n

Ch4 SC Fall 2016 8


Mamdani Fuzzy models [1975]
• Goal: Control a steam engine & boiler combination by a set
of linguistic control rules obtained from experienced human
operators.
• A Two-Rule Mamdani Fuzzy Inference system derives the
o v e r a l l output z when subjected to t w o crisp input x & y
• F u z z i f i c a t i o n --I n f e r e n c e –D e f u z z i f i c a t i o n
Inference
Input Fuzzifier Defuzzifier Output
Engine
Non-fuzzy Non-fuzzy
(Crisp) (Crisp)

Fuzzy
Knowledge base

Ch4 SC Fall 2016 9


• A crisp input value is extracted
• Use m i n or (algebraic/Bounded/Drastic) product for T -
norm;
• Use m a x or (algebraic/Bounded/Drastic) sum as S -
n o r m or, T - c o n o r m ;
• M a x - M i n or Max-product composition, for implication.
•H o w t o “ F u z z i f y ” a c r i s p i n p u t :

Ch4 SC Fall 2016 10


Mamdani’s FIS using m i n & m a x for T -
n o r m & T-conorm operators, respectively.

Ch4 SC Fall 2016 11


How to “infer”

R1:I f pressure is low and temperature is high t h e n power is low


R2:I f pressure is average and temperature is warm t h e n power is
moderate
Ch4 SC Fall 2016 12
Defuzzification
• C e nte r o f G rav i t y Method, C entroid O f A rea Z C O A :

Most Widely
Adopted
Defuzzification
Strategy

 A ( Z ) : A g g re gate d o u t p u t M F
Ch4 SC Fall 2016 13
• B i s e c t o r o f A r e a Z B O A , This operator satisfies:

where

and
• The vertical line z = z B O A partitions the region
between z = α , z = β , y = 0 & y =  A ( Z ) into
t w o regions with the same area.
• M e a n o f M ax i m u m Z M O M
This operator computes the
average of the maximizing z Where, Z ’ { z |  A ( z ) =  * }

at which the MF reaches a maximum *.


Ch4 SC Fall 2016 14
Summary of Defuzzification Methods

LOM (largest of maximum) SOM (Smallest of maximum)


MOM (middle of maximum)

Ch4 SC Fall 2016 15


Example #1: S I S O M a m d a n i
Fuzzy model
Single Input Single Output SISO Mamdani fuzzy model
with 3 rules:
R 1: I f X i s s m a l l t h e n Y i s s m a l l

R 2: I f X i s m e d i u m t h e n Y i s m e d i u m

R 3: I f X i s l a r g e t h e n Y i s l a r g e
X = input  [-10, 10]  Slide 17
Y = output  [0, 10]  Slide 17
Using m a x - m i n composition ( R 1 o R 2 o R 3 ) , and
C e n t r o i d defuzzification, we obtain the following
overall input-output curve (Slide 17):
Ch4 SC Fall 2016 16
SISO antecedent & consequent MFs
Ch4 SC Fall 2016 17
Overall input-output curve
Ch4 SC Fall 2016 18
Example #2: T I S O Mamdani Fuzzy
model
• Two Input Single Output TISO Mamdani fuzzy model with
4 rules:
R 1 : If X is small & Y is small then Z is negative large

R 2 : If X is small & Y is large then Z is negative small

R 3 : If X is large & Y is small then Z is positive small

R 4 : If X is large & Y is large then Z is positive large


X = [-5, 5]; Y = [-5, 5]; Z = [-5, 5], with m a x - m i n
composition & c e n t r o i d defuzzification, we can
determine the overall input output curve and surface:
Ch4 SC Fall 2016 19
TISO antecedent & consequent MFs (mam2.m)
Ch4 SC Fall 2016 20
Overall input-output surface (mam2.m)
21
Ch4 SC Fall 2016
• Other Variants:
– Classical fuzzy reasoning is not tractable,difficult to compute
– In practice, a fuzzy inference system may have a certain
reasoning mechanism that does not follow the strict
definition of the compositional rule of inference.
– Reminder:
C'  ( A'*B' )  ( A * B  C)
     
premise1 premise 2

 C' ( z )    A' ( x )   B' ( y )   A ( x )   B ( y )   C ( z )


x,y

   A' ( x )   B' ( y )   A ( x )   B ( y )   C ( z )


x,y



x

   A' ( x )   A ( x )  


 
 
y
 B' ( y )   B ( y )    (z )


C

w1 w2
 (w 1  w 2 )   C ( z )
Ch4 SC Fall 2016 22
• w1  degree of compatibility between A & A’
• w2  degree of compatibility between B & B’
• w1  w2  degree of fulfillment of the fuzzy rule
(antecedent part) = firing strength
• Qualified (induced) consequent MFs represent how
the firing strength gets propagated & used in a fuzzy
implication statement
• Overall output MF aggregate all the qualified
consequent MFs to obtain an overall output MF
– One might use p r o d u c t for firing strength computation;
– One might use m i n for qualified consequent MFs
computation
– One might use m a x for MFs aggregation into an overall
output MF
Ch4 SC Fall 2016 23
• Conclusion: To completely specify the operation of a
Mamdani f i s System, we need to assign a function for
each of the following operators:
– A N D operator (usually T-norm) to compute the rule
firing strength with AND’ed antecedents;
– O R operator (usually T-conorm) to calculate the firing
strength of a rule with OR’ed antecedents;
– I m p l i c a t i o n operator (usually T-norm) to calculate
qualified consequent MFs based on given firing strength
– A g g r e g a t e operator (usually T-conorm) to aggregate
qualified consequent MFs to generate an overall output
MF (composition of facts & rules to derive a
consequent);
– D e f u z z i f i c a t i o n operator for transforming an output
MF to a crisp single output value.
Ch4 SC Fall 2016 24
Under the sum-product composition:
Final crisp output (of a Mamdani f i s with Centroid
defuzzification) e q u a l s Weighted average of Centroids
of consequent MFs;
Where, each of the weighting factors equals the product
of the a firing strength and the consequent MF’s area;
That is, w(rulei)=(firing strength)i*Area (consequent MFs)
Proof(PP80-81) Use the equation:
 C' ( z )  w 1 C1 ( z )  w 2 C2 ( z )
and compute: z C O A (centroid defuzzification)
Conclusion: Final crisp output can be computed if:
–Area of each consequent MF is known
–Centroid of each consequent Mf is known
RUN Mamdani FIS mam21
Ch4 SC Fall 2016 25
Ch4 SC Fall 2016 26
Sugeno Fuzzy Models
• Also known as Takagi, Sugeno & Kang, T S K model (1985);
• Goal: Generation of f u z z y r u l e s from a given
input-output data set
• A TSK fuzzy rule has the form:
If x is A & y is B then z = f(x, y)
Where A & B are f u z z y s e t s in the a n t e c e d e n t ,
while z = f ( x , y ) is a c r i s p f u n c t i o n in the c o n s e q u e n t
f ( x , y ) is very often a p o l y n o m i a l function in the
i n p u t variables x & y .
• When f ( x , y ) is a f i r s t - o r d e r p o l y n o m i a l , the resulting
fuzzy inference is: A f i r s t - o r d e r S u g e n o fuzzy model;
Ch4 SC Fall 2016 27
Sugeno Fuzzy Models
• f(x,y) is a first order polynomial
Example: a two-input one-output TSK
I F x i s A j a n d y i s B k t h e n z i= p x + q y + r
• The degree the input matches ith rule is typically computed
using min operator: w i = m i n ( m A ( x ) , m B ( y ) )
j k
Each rule has a crisp output
• Overall output is obtained via weighted average (reduce
computation time of defuzzification required in a
Mamdani model) 𝐳 = σ𝒊 𝒘 𝒊 𝒛 𝒊 / σ𝒊 𝒘 𝒊
Where Wi is matching degree of rule Ri
(result of the if … part evaluation)
• To further reduce computation, weighted sum may be
used, I.e. 𝐳 = σ𝒊 𝒘 𝒊 𝒛 𝒊
Ch4 SC Fall 2016 28
Sugeno Fuzzy Models

Ch4 SC Fall 2016 29


• However, if we have smooth membership
functions (fuzzy rules) the overall input-output
curve becomes a smoother one (sug1.m)

30
Ch4 SC Fall 2016
Example 1: Single-input single output fuzzy model with 3
rules:
•I f X i s s m a l l then Y = 0.1 X +6.4.
•I f X i s m e d i u m then Y = -0.5X +4.
•I f X i s l a r g e then Y = X-2.
• If “small”, “medium.” and “large” are non fuzzy sets , then
the overall input-output curve is piecewise linear.

Ch4 SC Fall 2016 31


• If “small”, “medium,” and “large” are fuzzy sets (smooth
membership functions) , then the overall input-output
curve is a smooth one.

Ch4 SC Fall 2016 32


Example 2: Two-input single output fuzzy model with 4
rules:
R1: if X is small & Y is small then z =-x+y+1
R2 : if X is small & Y is large then z =- y +3
R3 : if X is large & Y is small then z =- x +3
R4 : if X is large & Y is large then z=x+y+2
R1  (x  s) & (y  s)  w 1
R2  (x  s) & (y  l)  w 2
R3  (x  l) & (y  s)  w 3
R4  (x  l) & (y  l)  w 4
Aggregated consequent 
F[(w 1 , z 1 ); (w 2 , z 2 ); (w 3 , z 3 ); (w 4 , z 4 )]
=weighted average
Ch4 SC Fall 2016 33
Antecedent MFs (sug2.m)
Ch4 SC Fall 2016 34
Overall input-output surface
Ch4 SC Fall 2016 35
• Example: Single-Input Tsukamoto fuzzy model with 2 rules
R1 : if X is small then Y is C1
R2 : if X is medium then Y is C2
• The consequent of each fuzzy if-then rule is represented
by a fuzzy set with monotonical MF
• As a result, the inferred output of each rule is defined as
a crisp value induced by the rules’ firing strength.
• Overall output: The weighted average of each rule’s O/P.

Ch4 SC Fall 2016 36


• Example: Single-Input Tsukamoto fuzzy model with 3 rules
R1 : if X is small then Y is C1
R2 : if X is medium then Y is C2
R3 : if X is large then Y is C3

Ch4 SC Fall 2016 37


Other Considerations
• It is clear that the spirit of fuzzy inference systems is similar
to that of “divide and conquer”.
• Input Space Partitioning:
– The antecedent of a fuzzy rule defines a local fuzzy
region;
– The consequent describes the behavior within the fuzzy
region and essentially can be a:
• Consequent MF Mamadani Fuzzy models,
• A constant value (zero-order Sugeno model), or
• A linear equation (first-order Sugeno model).
– There are 3 methods of partitioning input spaces to
form the antecedents of fuzzy rules applicable to the
three types of fuzzy models: GRID, TREE AND SCATTER
PARTITIONING.
Ch4 SC Fall 2016 38
• G r i d P a r t i t i o n (Oftenly used): Each region is included
in a square area  h y p e r c u b e
– Difficult to partition the input using the Grid
in the case of a large number of inputs. For
k inputs & m MFs for each  m k r u l e s !!
(A 10-input fuzzy model & 2 MFs on each input would
result in 210(1024) fuzzy rules excessively large).
• Tree Partition: Each region can be uniquely specified along
a corresponding decision tree.
– Relieves the problem of an exponential
increase in the number of rules.
– More MFs for each input are needed to
define these fuzzy regions.
– Used by CART (Classification and Regression Tree)
algorithm.
Ch4 SC Fall 2016 39
• Scatter Partition: Extracts fuzzy rules directly from
numerical data by covering a subset of the
whole input space that characterizes a region
of possible occurrence of the input vectors,
the scatter partition can also limit the number
of rules to a reasonable amount. However, the
scatter partition is usually dictated by desired I/P data pairs
• Fuzzy Modeling: Generally, the design of a F I S is based
on the p a s t k n o w n b e h a v i o r o f a t a r g e t s y s t e m
• The developed F I S is expected to r e p r o d u c e the
b e h a v i o r of the target system.
• Examples of FIS systems:
– If the target system is a human operator in charge of a
chemical reaction process, then the FIS becomes a fuzzy
logic controller that can regulate and control the process.
Ch4 SC Fall 2016 40
• If the target system is a medical doctor, then the FIS
becomes a fuzzy expert system for medical diagnosis.
• To construct a fuzzy inference system for an application,
follow the standard method, fuzzy modelling, that has
features including:
– The rule structure (that can describe the behavior of the
target system by means of linguistic terms) of a FIS
makes it easy to Incorporate human expertise about the
target system directly into the modelling process. That
is, fuzzy modelling takes advantage of domain
knowledge (linguistic data!) that might not be easily or
directly employed in other modelling approaches.
– Use conventional system identification techniques for
fuzzy modeling when input-output data of a target
system are available (numerical data).
Ch4 SC Fall 2016 41
• General guidelines about fuzzy modeling: Two Stages
A. Identification of the surface (Rule) structure: Describes
the behavior of the target system using linguistic terms:
i. Select relevant input-output variables
ii. Choose a specific type of FIS
iii.Determine the number of linguistic terms associated
with each input & output variables (for a Sugeno
model, determine the order of consequent equations)
iv.Design a collection of fuzzy if-then rules;
–Note: To accomplish these tasks, we rely on:
• Our own knowledge (common sense, simple physical
laws, etc.) of the target system,
• Information provided by human experts who are familiar
with the target system (could be the experts themselves),
• simply trial and error.
Ch4 SC Fall 2016 42
B.Identification of deep structure (that determines the
MFs of each linguistic term (and the coefficients of each
rule’s output polynomial if a Sugeno fuzzy model is used):
1.Choose an appropriate family of parameterized MF’s
2.Interview human experts familiar with the target
systems to determine the parameters of the MF’s used
in the rule base;
3.Refine the parameters of the MF’s using regression &
optimization techniques (best performance for a plant
in control!)
• Tasks 1 and 2 assumes the availability of human experts
• Task 3 assumes the availability of the desired I-O data set
• Various system identification & optimization techniques for
parameter identification in task 3 are available. Including:
Adaptive Network-based Fuzzy Inference System, ANFIS
Ch4 SC Fall 2016 43

Вам также может понравиться