22
Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( J.-S. Roger Jang ( 張張張 張張張 ) CS Dept., Tsing Hua Univ., Taiwan CS Dept., Tsing Hua Univ., Taiwan http://www.cs.nthu.edu.tw/~jang http://www.cs.nthu.edu.tw/~jang [email protected] [email protected] Fuzzy Rules and Fuzzy Reasoning

Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan [email protected] Fuzzy

Embed Size (px)

Citation preview

Page 1: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Chap 3: Fuzzy Rules and Fuzzy ReasoningChap 3: Fuzzy Rules and Fuzzy Reasoning

J.-S. Roger Jang (J.-S. Roger Jang (張智星張智星 ))

CS Dept., Tsing Hua Univ., TaiwanCS Dept., Tsing Hua Univ., Taiwanhttp://www.cs.nthu.edu.tw/~janghttp://www.cs.nthu.edu.tw/~jang

[email protected]@cs.nthu.edu.tw

Fuzzy Rules and Fuzzy Reasoning

Page 2: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

2

OutlineOutline

Extension principle

Fuzzy relations

Fuzzy if-then rules

Compositional rule of inference

Fuzzy reasoning

Page 3: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

3

Extension PrincipleExtension Principle

A is a fuzzy set on X :

A x x x x x xA A A n n ( ) / ( ) / ( ) /1 1 2 2

The image of A under f( ) is a fuzzy set B:

B x y x y x yB B B n n ( ) / ( ) / ( ) /1 1 2 2

where yi = f(xi), i = 1 to n.

If f( ) is a many-to-one mapping, then

Bx f y

Ay x( ) max ( )( )

1

Page 4: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

4

Fuzzy RelationsFuzzy Relations

A fuzzy relation R is a 2D MF:

Examples:• x is close to y (x and y are numbers)

• x depends on y (x and y are events)

• x and y look alike (x, and y are persons or objects)

• If x is large, then y is small (x is an observed reading and Y is a corresponding action)

R x y x y x y X YR {(( , ), ( , ))|( , ) }

Page 5: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

5

Max-Min CompositionMax-Min Composition

The max-min composition of two fuzzy relations R1 (defined on X and Y) and R2 (defined on Y and Z) is

Properties:• Associativity:

• Distributivity over union:

• Week distributivity over intersection:

• Monotonicity: R Ry

R Rx z x y y z1 2 1 2 ( , ) [ ( , ) ( , )]

R S T R S R T ( ) ( ) ( )

R S T R S T ( ) ( )

R S T R S R T ( ) ( ) ( )

S T R S R T ( ) ( )

Page 6: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

6

Max-Star CompositionMax-Star Composition

Max-product composition:

In general, we have max-* composition:

where * is a T-norm operator.

R Ry

R Rx z x y y z1 2 1 2 ( , ) [ ( , ) ( , )]

R Ry

R Rx z x y y z1 2 1 2 ( , ) [ ( , )* ( , )]

Page 7: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

7

Linguistic VariablesLinguistic Variables

A numerical variables takes numerical values:

Age = 65

A linguistic variables takes linguistic values:

Age is old

A linguistic values 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 yound and not very old, ...}

Page 8: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

8

Linguistic Values (Terms)Linguistic Values (Terms)

complv.m

Page 9: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

9

Operations on Linguistic ValuesOperations on Linguistic ValuesCON A A( ) 2

DIL A A( ) . 0 5

INT AA x

A xA

A

( ), ( ) .

( ) , . ( )

2 0 05

2 05 1

2

2

Concentration:

Dilation:

Contrast

intensification:

intensif.m

Page 10: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

10

Fuzzy If-Then RulesFuzzy If-Then Rules

General format:If x is A then y is B

Examples:• If pressure is high, then volume is small.

• If the road is slippery, then driving is dangerous.

• If a tomato is red, then it is ripe.

• If the speed is high, then apply the brake a little.

Page 11: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

11

Fuzzy If-Then RulesFuzzy If-Then Rules

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

Page 12: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

12

Fuzzy If-Then RulesFuzzy If-Then Rules

Two ways to interpret “If x is A then y is B”:• A coupled with B: (A and B)

• A entails B: (not A or B)

- Material implication

- Propositional calculus

- Extended propositional calculus

- Generalization of modus ponens

R A B A B x y x yA B ( ) ( )|( , )~

Page 13: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

13

Fuzzy If-Then RulesFuzzy If-Then RulesFuzzy implication function:

R A Bx y f x y f a b( , ) ( ( ), ( )) ( , )

fuzimp.m

A coupled with B

Page 14: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

14

Fuzzy If-Then RulesFuzzy If-Then Rules

A entails B

fuzimp.m

Page 15: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

15

Compositional Rule of InferenceCompositional Rule of Inference

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)

Page 16: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

16

Compositional Rule of InferenceCompositional Rule of Inference

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

cri.m

Page 17: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

17

Fuzzy ReasoningFuzzy Reasoning

Single rule with single antecedentRule: if x is A then y is B

Fact: x is A’

Conclusion: y is B’

Graphic Representation:

A

X

w

A’ B

Y

x is A’

B’

Y

A’

Xy is B’

Page 18: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

18

Fuzzy ReasoningFuzzy ReasoningSingle rule with multiple antecedent

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’

Page 19: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

19

Fuzzy ReasoningFuzzy Reasoning

Multiple rules with multiple antecedentRule 1: if x is A1 and y is B1 then z is C1

Rule 2: if x is A2 and y is B2 then z is C2

Fact: x is A’ and y is B’

Conclusion: z is C’

Graphic Representation: (next slide)

Page 20: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

20

Fuzzy ReasoningFuzzy Reasoning

Graphics representation: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’

Page 21: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

21

Fuzzy Reasoning: MATLAB DemoFuzzy Reasoning: MATLAB Demo

>> ruleview mam21

Page 22: Chap 3: Fuzzy Rules and Fuzzy Reasoning J.-S. Roger Jang ( 張智星 ) CS Dept., Tsing Hua Univ., Taiwan jangjang@cs.nthu.edu.tw Fuzzy

Fuzzy Rules and Fuzzy Reasoning

22

Other VariantsOther Variants

Some terminology:• Degrees of compatibility (match)

• Firing strength

• Qualified (induced) MFs

• Overall output MF