fuzzy logic lecture_section 5 (fuzzy relations)

59
Shahid Beheshti University of Tehran Presented by: Fuzzy Logic L5 Requirements : …. +98 21 897 882 08 kourosh.eghbalpour Hamid Eghbalpour Operating Manager of Asia Peyman.Co [email protected] [email protected] https://sbu-ir.academia.edu/HEghbalpo ur

Upload: mun

Post on 06-Feb-2023

0 views

Category:

Documents


0 download

TRANSCRIPT

Shahid Beheshti University of Tehran

Presented by:

Fuzzy Logic L5Requirements : ….

+98 21 897 882 08

kourosh.eghbalpour

Hamid Eghbalpour Operating Manager of Asia Peyman.Co

[email protected] [email protected]

https://sbu-ir.academia.edu/HEghbalpour

2

Lecture 05Lecture 05

Fuzzy Relations

3

Representations of Representations of fuzzy relationfuzzy relation

List of ordered pairs with their membership grades

MatricesMappingsDirected graphs

4

MatricesMatricesFuzzy relation R on XYX={x1, x2 , …, xn}, Y={y1, y2 , …, ym}rij=R(xi , yj) is the membership degree of pair (xi , yj)

5

Example (very far Example (very far from)from)

Example: X={Beijing, Chicago, London, Moscow, New York, Paris, Sydney, Tokyo}

XVery far fromVery far from

6

MappingsMappingsThe visual representationsOn finite Cartesian products

Document D = {d1, d2 , …, d5}Key terms T = {t1, t2 , t3, t4 }

7

Directed graphsDirected graphs

8

Aa1

a2

a3

a4

Bb1b2b3b4b5

Binary Relation Binary Relation ((RR))

R A B

9

Binary Relation Binary Relation ((RR))

R A B

Aa1

a2

a3

a4

Bb1b2b3b4b5

1 1 1 3 2 5

3 1 3 4 4 2

( , ),( , ),( , )( , ),( , ),( , )a b a b a b

Ra b a b a b

1 0 1 0 00 0 0 0 11 0 0 1 00 1 0 0 0

RM

1 1a Rb 1 3a Rb 2 5a Rb

3 1a Rb 3 4a Rb 4 2a Rb

10

Crips RelationsCrips RelationsCrips relations are crips subsets of X×Y, the strengthOf this relationship between ordered pairs of elementsis measured by the characteristic function:

YXyxYXyxyxYX ),(,0

),(,1),(

}3,2,1{X },,{ cbaY

123

abc

YX

RyxRyxyxR ),(,0

),(,1),(

cba

R

111111111

321

11

Crips RelationsCrips RelationsThe elements in two sets A and B are given as A = {0, 1} and B = {a, b, c}.Various Cartesian products of these two sets can be written as shown:

A × B = {(0, a), (0, b), (0, c), (1, a), (1, b), (1, c)}B × A = {(a, 0), (a, 1), (b, 0), (b, 1), (c, 0), (c, 1)}A × A = A2 = {(0, 0), (0, 1), (1, 0), (1, 1)}B × B = B2 = {(a, a), (a, b), (a, c), (b, a), (b, b), (b, c), (c, a), (c, b), (c, c)}

1212

Crips RelationsCrips Relations}2,1{X },{ baY

ba

R

10

0121

12

ab

YX

13

   

 R verdant

half-mature

mature

green 1 0 0

yellow 0 1 0

red 0 0 1

X={ green,  yellow,   red }

Y={verdant,   half-mature,   mature }

a crisp formulation of a relation        between the two crisp sets would look like this in tabular form:

Crips RelationsCrips Relations

YX

14

Operations on Crips Operations on Crips RelationsRelations

0000000000000000

relationNullO

1111111111111111

relationCompleteE

)],(),,(max[),(:),( yxyxyxyxSRUnion SRSRSR

)],(),,(min[),(:),(sec yxyxyxyxSRtionInter SRSRSR

),(1),(:),( yxyxyxRComplement RRR

),(),(:),( yxyxyxSRtContainmen SRR

)0( EXandIdentity

15

Properties of Crips Properties of Crips RelationsRelations

The properties of commutativity, assosiativity, idempotency and distributivity all hold for crisp relations.

De Morgan’s laws and the excluded middle laws also hold for crisp

SRT

16

Composition of Crips Composition of Crips RelationsRelations

Let R be a relation that relates elements from universe XTo universe Y, and let S be a relation that relates elementsFrom Universe Y to universe Z.A useful question we seek to answer is whether we can find a relation, T, that relates the same elements in universeX that R contains to the same elements in universe Z thatS contains.

R SX Y Z

SRT ),(),((),( zyyxzx SRYyT

17

Composition of Crips Composition of Crips RelationsRelations

SRT ),(),((),( zyyxzx SRYyT

x1

YX

x2x3

y1y2y3y4

z1

z2

Z

4321

000010000101

3

2

1

yyyy

xxx

R

21

00100010

4

3

2

1

zz

yyyy

S

21

000010

3

2

1

zz

xxx

T

0)]0,0min(),1,1min(),0,0min(),1,1max[min(),(0)]0,0min(),0,1min(),0,0min(),0,1max[min(),(

21

11

zxzx

T

T

And for rest.

18

Fuzzy RelationsFuzzy RelationsFuzzy relations also map elements of one universe,Say X, to those of another universe, say Y, through the Cartesian product of two universes. However, the “strength” of the relation between ordered pairs Of the two universes is not measured with the Characteristic function, but rather with a membershipFunction expressing various “degrees” of strength of The relation on the unit interval [0,1].The fuzzy relation R has membership function:

))(),(min(),(),( yxyxyx BABAR

19

Operations on Fuzzy Operations on Fuzzy RelationsRelations

0000000000000000

relationNullO

1111111111111111

relationCompleteE

)],(),,(max(),(:),( yxyxyxyxSRUnion SRSRSR

)],(),,(min(),(:),(sec yxyxyxyxSRtionInter SRSRSR

),(1),(:),( yxyxyxRComplement RRR

),(),(:),( yxyxyxSRtContainmen SRR

20

Properties of Fuzzy Properties of Fuzzy RelationsRelations

Just as for crisp relation, the properties of commutativity, assosiativity, idempotency and distributivity all hold for fuzzy relations.

De Morgan’s laws hold for fuzzy but the excluded middle laws for relation do not result in the null relation, O, or the complete relation, E.0

RR

ERR

21

Example of Fuzzy Example of Fuzzy RelationsRelations

))(),(min(),(),( yxyxyx BABAR

For example, let:

321

15.02.0xxx

A 21

9.03.0yy

B

2

3

2

11

9.03.05.03.02.02.0

yy

xxx

RBA

22

   

X={ green,  yellow,   red }

Y={verdant,   half-mature,   mature }A Fuzzy formulation of a relation        between the two Fuzzy sets would look like this in tabular form:

Fuzzy RelationsFuzzy Relations

YX

verdant

half-mature

mature

green 1 0.5 0

yellow 0.3 1 0.4

red 0 0.2 1

23

Fuzzy RelationsFuzzy Relations

24

Fuzzy RelationsFuzzy RelationsA fuzzy relation R is a 2D MF:

( ,,( , ) ( , )) |R x yx y x yR X Y

25

Example (Approximate Example (Approximate Equal)Equal)

( ,,( , ) ( , )) |R x yx y x yR X Y

{1,2,3,4,5}X Y U

1 0.8 0.3 0 00.8 1 0.8 0.3 00.3 0.8 1 0.8 0.30 0.3 0.8 1 0.80 0 0.3 0.8 1

RM

otherwisevuvuvu

vuR

023.018.001

,

26

Inverse operationInverse operation

Given fuzzy binary relation RXY– Inverse R-1YX– R-1(y,x) = R(x,y)– (R-1) -1 = R

The transpose of R

27

Composition of Fuzzy Composition of Fuzzy RelationsRelations

Fuzzy composition can be defined just as it is for crisp relations. Suppose R be a fuzzy relation that relates elements from universe X to universe Y, and let S be a fuzzy relation that relates elements from universe Y to universe Z and T is a fuzzy relation that relates the same elements in universeX that R contains to the same elements in universe Z thatS contains. Then fuzzy max-min composition is defined as:

R SX Y Z

SRT SRT

),(),((),( zyyxzx SRYyT

28

Example of Fuzzy Example of Fuzzy CompositionCompositionFor example,

let: },{ 21 xxX

2

2

1 1

4.08.05.07.0

yy

xx

R

},{ 21 yyY },,{ 321 zzzZ

321

5.07.01.02.06.09.0

2

1zzz

yy

S

321

4.06.08.05.06.07.0

2

1zzz

xx

SRT

),(),((),( zyyxzx SRYyT

),(),((),( zyyxzx SRYyT

321

20.048.072.025.042.063.0

2

1zzz

xx

SRT

29

Example of Fuzzy Example of Fuzzy CompositionCompositionThe colour-maturity

relation R

R verdant half-mature mature

green 1 0.5 0yellow 0.3 1 0.4

red 0 0.2 1

and define for a maturity-taste relation S

S sour tasteless sweet

verdant 1 0.2 0half-

mature 0.7 1 0.3

mature 0 0.7 1then by applying composition to the elements of these two tables, the following is obtained:

R o S sour tasteless sweet

green 1 0.5 0.3yellow 0.7 1 0.4

red 0.2 0.7 1

30

Max-Min CompositionMax-Min Composition

A fuzzy relation defined on X an Z.

X Y ZR: fuzzy relation defined on X and Y.

S: fuzzy relation defined on Y and Z.R。 S: the composition of R and S.

(, ) max min ( , ), ( , )R S y R Sx z x y y z

( , ) ( , )y R Sx y y z

0.1 0.2 0.0 1.00.9 0.2 0.8 0.4min0.1 0.2 0.0 0.4max

ExampleExample

1 0.4 0.2 0.32 0.3 0.3 0.33 0.8 0.9 0.8

R S

(, ) max min ( , ), ( , )S R v R Sx y x v v y

1 0.1 0.2 0.0 1.02 0.3 0.3 0.0 0.23 0.8 0.9 1.0 0.4

R a b c d0.9 0.0 0.30.2 1.0 0.80.8 0.0 0.70.4 0.2 0.3

Sabcd

32

Example (composition of fuzzy Example (composition of fuzzy relations)relations)

X = {a,b,c}Y = {1,2,3,4}Z = {A,B,C}

33

Example of Fuzzy Example of Fuzzy CompositionComposition

x1

x2

x3

x4

y1

y2

y3

z1

z2

z3

ZYSYXR

1.00.8

0.9

0.8

1.0

0.9

0.80.7

34

Example of Fuzzy Example of Fuzzy CompositionComposition

0.1008.00009.0008.01

R

007.08.000009.0

S

)]7.00()08.0()9.01[(),( 11 zxR

0000007.0000000007.00008.0000000008.00000009.0

SR

35

Example of Fuzzy Example of Fuzzy CompositionComposition

x1

x2

x3

x4

z1

z2

z3

007.0007.08.0008.009.0

SR

0.90.80.80.7

0.7

36

Example (matrix Example (matrix composition)composition)

P XY Q YZ R XZ

37

Max-Product Max-Product CompositionComposition

( , ) max ( , ) ( , )R S v R Sx y x v v y

A fuzzy relation defined on X an Z.

X Y Z R: fuzzy relation defined on X and Y.

S: fuzzy relation defined on Y and Z.R。 S: the composition of R and S.

Max-min composition is not mathematically tractable, therefore other compositions such as max-product composition have been suggested.

38

Example : A certain type of virus attacks cells of the human body. The infected cells can be visualized using a special microscope. The microscope generates digital images that medical doctors can analyze and identify the infected cells. The virus causes the infected cells to have a black spot, within a darker grey region.A digital image process can be applied to the image. This processing generates two variables: the first variable, P, is related to black spot quantity (black pixels), and the second variable, S, is related to the shape of the black spot, i.e., if they are circular or elliptic. In these images it is often difficult to actually count the number of black pixels, or to identify a perfect circular cluster of pixels; hence, both these variables must be estimated in a linguistic way.An infected cell shows black spots with different shapes in a micrograph.

39

Suppose that we have two fuzzy sets, P which represents the number of black pixels (e.g., none with black pixels, C1, a few with black pixels, C2, and a lot of black pixels, C3), and S which represents the shape of the black pixel clusters, e.g., S1 is an ellipse and S2 is a circle. So we have

and we want to find the relationship between quantity of black pixels in the virus and the shape of the black pixel clusters. Using a Cartesian product between Pand S gives:

40

Now, suppose another microscope image is taken and the number of black pixels is slightly different; let the new black pixel quantity be represented by a fuzzy set , P’ :

Using max–min composition with the relation R will yield a new value for the fuzzy set of pixel cluster shapes that are associated with the new black pixel quantity:

41

ProjectionProjectionR

XR R X YR R Y

Dimension Reduction

42

ProjectionProjectionR

XR R X YR R Y

R

XR R X YR R Y

XR R X YR R Y max ( , )/RX y

x y xmax ( , )/RY xx y y

( ) max ( , )YR Rx

y x y ( ) max ( , )XR Ry

x x y

Dimension Reduction

43

Cylindrical Cylindrical Extension Extension

Dimension Expansion

A : a fuzzy set in X.C(A) = [AXY] : cylindrical extension of A.

( ) ( )|( , )AX YC A x x y

( )( , ) ( )C A Ax y x

44

Implication can be represented by Implication can be represented by relation Rrelation R

Suppose the implication operation involves two differentuniverses of discourse; P is a proposition described by set A,which is defined on universe X, and q is a proposition described by set B, which is defined on universe Y. Then the implication P Q can be represented in set-theoric terms by the relation R, where R is defined by:

XBandYywhereByTHENXAandXxwhereAxIF

BTHENAIFYABAR

,)()(

45

Implication can be represented by Implication can be represented by relation Rrelation R

CELSEBTHENAIFCABAR ,,)()(

46

Implication can be represented by Implication can be represented by relation R,relation R,Example:Example:

}40

31

21

10{ A

}4,3,2,1{X }6,5,4,3,2,1{Y

}60

50

41

31

20

10{ B

IF A, THEN B

000000001100001100000000

BA

111111000000000000111111

YA

}41

30

20

11{ A

}61

51

41

31

21

11{ Y

111111001100001100111111

)()( YABAR

47

Implication can be represented by Implication can be represented by relation Rrelation RExample:Example:

}40

31

21

10{ A

}4,3,2,1{X }6,5,4,3,2,1{Y

}60

50

41

31

20

10{ B

IF A, THEN B, ELSE C

000000001100001100000000

BA

110000000000000000110000

CA

}41

30

20

11{ A

}61

51

40

30

20

10{ C

110000001100001100110000

4321

)()( CABAR

48

Implication can be represented by Implication can be represented by relation R,relation R,Example:Example:

}42.0

31

26.0

10{ A

}4,3,2,1{X }6,5,4,3,2,1{Y

}53.0

48.0

31

24.0

10{ B

IF A, THEN B

02.02.02.02.0003.08.014.0003.06.06.04.00000000

BA

8.08.08.08.08.08.00000004.04.04.04.04.04.0111111

YA

}48.0

30

24.0

11{ A

}61

51

41

31

21

11{ Y

8.08.08.08.08.08.003.08.014.004.04.06.06.04.04.0111111

)()( YABAR

49

Approximate ReasoningApproximate Reasoning

}42.0

31

26.0

10{ A

}4,3,2,1{X }6,5,4,3,2,1{Y

}53.0

48.0

31

24.0

10{ B

Rule 1:IF A, THEN BRule 2:IF A’, THEN B’

02.02.02.02.0003.08.014.0003.06.06.04.00000000

BA

8.08.08.08.08.08.00000004.04.04.04.04.04.0111111

YA

}48.0

30

24.0

11{ A

}61

51

41

31

21

11{ Y

8.08.08.08.08.08.003.08.014.004.04.06.06.04.04.0111111

)()( YABAR

}40

33.0

21

15.0{' A

}65.0

55.0

46.0

36.0

25.0

15.0{'' RAB

50

A = {u | A(u) } is called -cut.1A 2A and 1+A 2+A, when 2 1, which implies that the set of all distinct -cuts (as well as strong -cuts) is always a nested family of crisp sets.

+A = {u | A(u) > } is called strong -cut. 0+A = {u | A(u) > 0} is called support of A. 1A = {u | A(u) = 1} is called core of A. When the core of A is not empty, A is called normal; otherwise, it is called subnormal.

The largest value of A is called the height of A, denoted as hA.

The set of distinct values of A(u),u U is called the level set of A and denoted as A.

--cutcut

51

Core

2A

1A

1

2

1

A(u)

u

hA(A is normal)

--cutcut

52

The significance of -cut representation of fuzzy sets is that it connects fuzzy sets with crsip sets.

Example: A = 0.2/x1 +0.4/x2+0.6/x3+0.8/x4+1/x5Its level set is A = {0.2,0.4,0.6, 0.8,1}, so it is associated with only 5-distinct -cuts, which are defined as follows:

0.2A = 1/x1+ 1 /x2+1/x3+1/x4+1/x50.4A = 0 /x1+ 1/x2+1/x3+1/x4+1/x50.6A = 0/x1+0/x2+1/x3+1/x4+1/x50.8A = 0/x1+0/x2+0/x3+1/x4+1/x51A = 0/x1+0/x2+0/x3+0/x4+1/x5

--cutcut

53

Theorem: (Decomposition theorem of fuzzy sets): For any A F(X),A = [0,1] A

We now convert each of the -cuts to a special fuzzy set A defined for each uA by the formula A = .A(u). We obtain the following results:0.2A = 0.2/x1+0.2/x2+0.2/x3+0.2/x4+0.2/x5

0.4A = 0/x1+0.4/x2+0.4/x3+0.4/x4+0.4/x5

0.6A = 0/x1+0/x2+0.6/x3+0.6/x4+0.6/x5

0.8A = 0/x1+0/x2+0/x3+0.8/x4+0.8/x5

1A = 0/x1+0/x2+0/x3+0/x4+1/x5

The union of these five special fuzzy set is exactly the original fuzzy set A, that is, A = 0.2A 0.4 A 0.6 A 0.8 A 1AA = 0.2/x1 +0.4/x2+0.6/x3+0.8/x4+1/x5

--cutcut

54

Example : Let us consider the discrete fuzzy set, using Zadeh’s notation, defined on universe X = {a, b, c, d, e, f },

55

We can reduce this fuzzy set into several λ-cut sets, all of which are crisp. For example, we can define λ-cut sets for the values of λ = 1,0.9, 0.6, 0.3, 0+, and 0.

56

Two different λ-cut sets for a continuous-valued fuzzy set.

57

λ-CUTS FOR FUZZY RELATIONS

58

Questions? Discussion? Suggestions ?

59