53
Fuzzy Inference Systems Fuzzy rules Mamdani systems Takagi-Sugeno systems

Fuzzy Inference Systems Fuzzy rules Mamdani systems Takagi

  • Upload
    others

  • View
    23

  • Download
    0

Embed Size (px)

Citation preview

Fuzzy Inference Systems

• Fuzzy rules

• Mamdani systems

• Takagi-Sugeno systems

Fuzzy systemsFuzzy systems manipulate fuzzy sets to model the

worldMost fuzzy systems are rule based

If water temperature is low and flow rate is low, then open the warm water tap slightly

antecedents

consequent

fuzzy set

Consequent can be a fuzzy set, a numberor another model (e.g. a linear model)

Antecedents describe a conditionin which a rule is valid locally

linguistic variable

A numerical variable takes numerical values:

Age = 65

A linguistic variables takes linguistic values:

Age is old

A linguistic value is a fuzzy set.

All linguistic values form a term set:

T(age) = {young, not young, very young,

middle aged, not middle aged,

old, not old, very old, more or less old,

not very young and not very old, ...}

0 10 20 30 40 50 60 70 80 90 1000

0.2

0.4

0.6

0.8

1

Age

Mem

bers

hip

Gra

des

(a) Primary Linguistic Values

OldYoung

0 10 20 30 40 50 60 70 80 90 1000

0.2

0.4

0.6

0.8

1

Age

Mem

bers

hip

Gra

des

(b) Composite Linguistic Values

Not Young and Not Old

More or Less Old Extremely Old

Young butNot Too Young

CON A A( ) = 2

DIL A A( ) .= 0 5

INT AA x

A xA

A

( ), ( ) .

( ) , . ( )=

≤ ≤¬ ¬ ≤ ≤

2 0 0 5

2 0 5 1

2

2

µµ

Concentration:

Dilation:

Contrast

intensification:

0 1 2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

1

X

Mem

bers

hip

Gra

d es

Effects of Contrast Intensifier

Fuzzy if-then rulesGeneral format:

If x is A then y is BExamples:

If pressure is high, then volume is smallIf restaurant is expensive, then order small dishesIf a tomato is red, then it is ripeIf the speed is high, then apply the brake a little

A coupled with B

AA

B B

A entails B

Two ways to interpret “If x is A then y is B”:

y

xx

y

Fuzzy implication function:mR( x , y )= f ( mA( x ) ,mB( y ))= f ( a ,b )

0 0.5 10

0.5

10

0.5

1

a

(a) Min

b

0 10 200

10

200

0.5

1

xy

0 0.5 10

0.5

10

0.5

1

a

(b) Algebraic Product

b

0 10 200

10

200

0.5

1

xy

0 0.5 10

0.5

10

0.5

1

a

(c) Bounded Product

b

0 10 200

10

200

0.5

1

xy

0 0.5 10

0.5

10

0.5

1

a

(d) Drastic Product

b

0 10 200

10

200

0.5

1

xy

A entails BBoolean fuzzy implication (based on )

Zadeh's max-min implication (based on )

Zadeh's arithmetic implication (based on )

Goguen's implication

mR( x , y )=max (1−mA( x ) ,mB( y ))

¬A∨B

¬A∨( A∧B)

mR( x , y )=max (1−mA( x ) ,min (mA( x ) ,mB( y )))

¬A∨BmR( x , y )=min (1−mA( x )+mB( y ) ,1)

mR( x , y )=min (mB( x )/mA( y ) ,1)

Material implication

0 0.5 10

0.5

10

0.5

1

a

(a) Zadeh's Arithmetic Rule

b

0 10 200

10

200

0.5

1

xy

0 0.5 10

0.5

10

0.5

1

a

(b) Zadeh's Max-Min Rule

b

0 10 200

10

200

0.5

1

xy

0 0.5 10

0.5

10

0.5

1

a

(c) Boolean Fuzzy Implication

b

0 10 200

10

200

0.5

1

xy

0 0.5 10

0.5

10

0.5

1

a

(d) Goguen's Fuzzy Implication

b

0 10 200

10

200

0.5

1

xy

Constructing fuzzy relationsPremise: Young people make long GSM calls

X = {18, 20, 22, 25, 30} [years]

Y = {1, 3, 5, 7, 10, 20} [min./call]

2.05.08.011)(

3025222018

young(x)

x

x

µ

19.05.02.01.00)(

20107531

long(y)

y

y

µ

20107531

y

young(x) into X x Y

Compute cylindrical extensions

2.030

5.025

8.022

120

118

)(xx µ

long(y) into X x Y

19.05.02.01.00)(

20107531

y

y

µ

2.02.02.02.02.02.0

5.05.05.05.05.05.0

8.08.08.08.08.08.0

111111

111111

19.05.02.01.00

19.05.02.01.00

19.05.02.01.00

19.05.02.01.00

19.05.02.01.00

Compute the aggregation of the two cylindrical extensions. Since “young” and “long” go together, you can use a conjunctive operator (e.g. minimum).

2.02.02.02.02.02.0

5.05.05.05.05.05.0

8.08.08.08.08.08.0

111111

111111

19.05.02.01.00

19.05.02.01.00

19.05.02.01.00

19.05.02.01.00

19.05.02.01.00

20107531

y

30

2522

20

18

x

2.02.02.02.01.00

5.05.05.02.01.00

8.08.05.02.01.00

19.05.02.01.00

19.05.02.01.00

min

R

19.05.02.01.00)(Pr

2.02.02.02.02.01.002.030

5.05.05.05.02.01.005.025

8.08.08.05.02.01.008.022

119.05.02.01.00120

119.05.02.01.00118

)(Pr19.05.02.01.00)(\)(

20107531

R

Ryxx

y

Y

Xµµ

long

young

Max-min compositionThe max-min composition of two fuzzy relations R

(defined on X and Y) and S (defined on Y and Z) is

The result is the combined relation defined on X and Z

)],(),([),( zyyxzx SRy

SR µµµ ∧=∨

example

=

2.02.00

5.05.00

8.05.00

15.00

15.00

15.00

9.05.00

5.05.00

2.02.00

1.01.00

000

2.02.02.02.01.00

5.05.05.02.01.00

8.08.05.02.01.00

19.05.02.01.00

19.05.02.01.00

R S R°S

People who make long GSM calls give a lot of money to clothing

Young people give a lot of money to clothing

Compositional rule of inferenceMax-min composition of a fuzzy set A on X and a

fuzzy relation R on X x Y

Returns the image of A transformed through the relation R

The composition of A and R can also be seen as the shadow of R on A (for every y)

μ A∘R( y )=maxx∈X

{μ A( x )∧μ R( x , y )} ∀ y∈Y

Derivation of y = b from x = a and y = f(x):

a and b: points

y = f(x) : a curve

a

b

y

xx

y

a and b: intervals

y = f(x) : an interval-valued

function

a

b

y = f(x) y = f(x)

Crisp case Fuzzy case

a is a fuzzy set and y = f(x) is a fuzzy relation

02

46

810

0

10

20

30

400

0.5

1

X

(a) Fuzzy Relation F on X and Y

Y

Mem

bers

hip

Gra

des

02

46

810

0

10

20

30

400

0.5

1

X

(b) Cylindrical Extension of A

Y

Mem

bers

hip

Gra

des

02

46

810

0

10

20

30

400

0.5

1

X

(c) Minimum of (a) and (b)

Y

Mem

bers

hip

Gra

des

02

46

810

0

10

20

30

400

0.5

1

X

(d) Projection of (c) onto Y

Y

Mem

bers

hip

Gra

des

[ ] [ ]5.05.05.02.01.00

2.02.02.02.01.00

5.05.05.02.01.00

8.08.05.02.01.00

19.05.02.01.00

19.05.02.01.00

01000 =

[ ] [ ]8.08.05.02.01.00

2.02.02.02.01.00

5.05.05.02.01.00

8.08.05.02.01.00

19.05.02.01.00

19.05.02.01.00

02.014.00 =

Inference: Coupled Memberships

• Rule: if x is A then y is B• Fact: x is A’• Conclusion: y is B’

Graphic Representation

)(

)())]()(([)( ''

yw

yxxy

B

BAAxB

µµµµµ

∧=∧∧∨=

A

X

w

A’ B

Y

x is A’

B’

Y

A’

Xy is B’

• Rule: if x is A and y is B then z is C• Fact: x is A’ and y is B’• Conclusion: z is C’Graphic Representation

A B T-norm

X Y

w

A’ B’ C2

Z

C’

ZX Y

A’ B’

x is A’ y is B’ z is C’

Multiple RulesFuzzy rules like A → B are represented as fuzzy

relationThe collection of all rules is represented as an

aggregated relation using the union operator, i.e.

R tot=∪i=1

N

Ri=∨i=1

N

Ri

A1 B1

A2 B2

T-norm

X

X

Y

Y

w1

w2

A’

A’ B’

B’ C1

C2

Z

Z

C’Z

X Y

A’ B’

x is A’ y is B’ z is C’

3

Fuzzy inference systemMultiple namesFuzzy rule-based systemFuzzy expert systemFuzzy modelFuzzy associative memoryFuzzy logic controllerFuzzy system (simply)

Building blocksFuzzifierRule baseInference engineDefuzzifier

Fuzz

i fie

r

Def

uz z

ifie

rRule base(knowledge base)

Inference engine

input

outp

ut

FuzzifierInterface between the outside world and the

fuzzy system (input)Transform a measurement in a fuzzy setMultiple methods:

singleton methodtriangular methodGaussian function method...

Fuzzificationsingleton method

= 1 when x = a, otherwise 0

X = {a,b,c,d}a { (a,1), (b,0), (c,0), (d,0) }→

triangular function method = max(0,|x-a|/s)

(Here a is the measurement)

mA( x )

mA( x )

Rule baseHeart of the knowledge base of the fuzzy systemEncodes the general relation between the inputs

and the outputsRules can be examples, rules of thumb, encoded

experience, qualitative relations between variables, etc.

Rules are often represented as if-then statements

Inference engineThe reasoning mechanism of the fuzzy system (to

infer: to reason/deduce)Combines actual inputs with the information

encoded in the rule base to compute the fuzzy output of the system

Usually implements the compositional rule of inference or some equivalent computation

Not as context-independent as the inference engine of an expert system

DefuzzifierInterface between the fuzzy systems and the

outside world (output)Needed when a crisp output is required (e.g. a

final decision, a control action, a final advice, etc.)Computes a number/symbol that represents the

output fuzzy setEnhances the interpolation properties of the

fuzzy system

Mamdani fuzzy modelsFive major steps:FuzzificationDegree of fulfillmentInferenceAggregationDefuzzificationComputations from Mamdani reasoning are

mathematically equivalent to the compositional rule of inference

FuzzificationCalculate the membership degrees of the

(measured) inputs to the linguistic terms in the fuzzifier

Crisp inputs Fuzzy inputs

Degree of fulfillmentWhen the antecedent (if-part) of a rule contains

multiple variables, the total match between all inputs and the rule antecedent must be determined

Degree of fulfilment determines to what degree the rule is valid

Take minimum of all fuzzified values in the rule antecedent

InferenceComputes the output of each fuzzy rule in the rule base,

given the degree of fulfilment of the rule baseModifies the output fuzzy set depending on the degree

of fulfilment

Clip the output fuzzy set at the height corresponding to the degree of fulfillment

AggregationMultiple rules may become active in a fuzzy system

Combined output of the fuzzy system is the combined output of all active rules

Corresponds to calculating the total relation from the relations of individual rules

Calculate maximum of individual fuzzy rule outputs

DefuzzificationDetermines the crisp output of the fuzzy system

Replaces the output fuzzy set with a representative number

Compute the defuzzified value using an agreed upon defuzzification operator (e.g. center of area)

Defuzzification rulesCentroid-of-area

Bisector of area

Mean of maximum

Smallest of maximum

Largest of maximum

∫∫=

Z A

Z A

dzz

dzzzz

)(

)(*

µ

µ

∫ ∫∞−∞

=*

*)()(

z

z AA dzzdzz µµ

*})(|{',*

'

' µµ ===∫∫

zzZdz

dzzz A

Z

Z

zZz '

min∈

zZz '

max∈

Mamdani - single input

-10 -8 -6 -4 -2 0 2 4 6 8 100

0.2

0.4

0.6

0.8

1

1.2

X

Me

mb

ers

hip

Gra

de

s small medium large

0 1 2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

1

1.2

Y

Me

mb

ers

hip

Gra

de

s small medium large

X is Small →Y is Small

X is Medium →Y is Medium

X is Large →Y is Large

Mamdani - single input

-10 -8 -6 -4 -2 0 2 4 6 8 100

1

2

3

4

5

6

7

8

9

10

X

Y

-1 0 -8 -6 -4 -2 0 2 4 6 8 1 00

0 . 2

0 . 4

0 . 6

0 . 8

1

1 . 2

X

Memb

ersh

ip Gr

ades

s m a l l m e d iu m la rg e

0 1 2 3 4 5 6 7 8 9 1 00

0 . 2

0 . 4

0 . 6

0 . 8

1

1 . 2

Y

Memb

ersh

ip Gr

ades

s m a l l m e d iu m la rg e

Mamdani - double input

-5 -4 -3 -2 -1 0 1 2 3 4 50

0 . 5

1

X

Mem

bersh

ip Gr

ades

s m a ll la rg e

-5 -4 -3 -2 -1 0 1 2 3 4 50

0 . 5

1

Y

Mem

bersh

ip Gr

ades

s m a ll la rg e

-5 -4 -3 -2 -1 0 1 2 3 4 50

0 . 5

1

Z

Mem

bersh

ip Gr

ades

la rg e n e g a ti ve s m a ll n e g a ti ve s m a ll p o s i t i ve la rg e p o s i t i v e

X is Small and Y is Small Z is →negative Large

X is Small and Y is Large Z is →negative Small

X is Large and Y is Small Z is →positive Small

if X is Large and Y is Large Z →is positive Large

Mamdani - double input

-5 -4 -3 -2 -1 0 1 2 3 4 50

0 . 5

1

X

Mem

bersh

ip Gr

ades

s m a ll la rg e

-5 -4 -3 -2 -1 0 1 2 3 4 50

0 . 5

1

Y

Mem

bersh

ip Gr

ades

s m a ll la rg e

-5 -4 -3 -2 -1 0 1 2 3 4 50

0 . 5

1

Z

Mem

bersh

ip Gr

ades

la rg e n e g a ti ve s m a ll n e g a ti ve s m a ll p o s i t i ve la rg e p o s i t i v e

- 5

0

5

- 5

0

5

- 3

- 2

- 1

0

1

2

3

XY

Z

Takagi-Sugeno fuzzy modelsFuzzy antecedents, crisp consequentsConsequent is a crisp function of inputs

if x is A and y is B then z = f(x,y)Zero-order Sugeno: constant consequent

if x is A and y is B then z = cFirst-order Sugeno: linear consequent

if x is A and y is B then z = ax+by+cOverall output is a weighted

average of individual rule outputs∑

∑=

==Ni i

Ni ii z

z

1

1*β

β

Fuzzy vs. crisp rule set

-10 -5 0 5 100

0.2

0.4

0.6

0.8

1

1.2

X

Mem

bers

hip

Gra

des

small medium large

(a) Antecedent MFs for Crisp Rules

-10 -5 0 5 100

2

4

6

8

X

Y

(b) Overall I/O Curve for Crisp Rules

-10 -5 0 5 100

0.2

0.4

0.6

0.8

1

1.2

X

Mem

bers

hip

Gra

des

small medium large

(c) Antecedent MFs for Fuzzy Rules

-10 -5 0 5 100

2

4

6

8

X

Y

(d) Overall I/O Curve for Fuzzy Rules

Sugeno - double inputIf X is Small and

Y is Small thenz = -x+y+1

If X is Small and Y is Large thenz = -y+3

If X is Large andY is Small thenz = -x+3

If X is Large andY is Large thenz = x+y+2

-5 -4 -3 -2 -1 0 1 2 3 4 50

0.2

0.4

0.6

0.8

1

1.2

X

Mem

bers

hip

Gra

des

Small Large

-5 -4 -3 -2 -1 0 1 2 3 4 50

0.2

0.4

0.6

0.8

1

1.2

Y

Mem

bers

hip

Gra

des

Small Large

Sugeno - double input

Approximation capabilityFuzzy systems are general function

approximators (c.f. neural networks)You can increase the accuracy of a mapping by

increasing the number of rules (examples) in the rule base

Best results are obtained when the number of linguistic terms in the input and the output are increased (a finer partition)

Using too many linguistic terms diminishes the transparency of fuzzy systems

Interpolation propertiesMultiple rules in a fuzzy system may fire (become

active) because fuzzy sets overlapFuzzy rules represent typical cases or examples of

the relation between two quantitiesThe reasoning mechanism interpolates between

the rules to determine the system output

18 20 22 24 26 28 30 32 34 36 380

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1young, middle-aged, old people

age

mem

bers

hip

0 2 4 6 8 10 12 14 16 18 200

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1short, medium, long GSM calls

duration

mem

bers

hip

Interpolation propertiesConsider a fuzzy system with three rulesYoung people make long GSM callsMiddle aged people make short GSM callsOld people make medium-long GSM calls

example

age duration

example