Models for Inexact Reasoning Fuzzy Logic – Lesson 5
Fuzzy Relations
Master in Computational Logic Department of Artificial Intelligence
Crisp Relations
• Crisp relations represent the presence or absence of
– Association – Interaction
between the elements from two or more sets
• Example
– M = {John, Mark}, W = {Mary, Sonya}
– John is Mary’s husband, Sonya is Mark’s wife
Crisp Relations
• A relation among crisp sets is a crisp subset
( 1, 2, , N ) 1 2 N
R X X K X ⊆ X × X × ×K X
• Crisp relations can be defined using characteristic functions
( 1, 2, , ) 1, 1, 2, ,
0,
N N
iff x x x R
R x x x
otherwise
∈
= K K
• Tuples in the relation identify elements related to one another
Example
• X = {U.S., France, Spain, U.K., Germany}
• Y = {Dollar, Pound, Euro}
• R = Association between a country and its currency
U.S. France Spain U.K. Germany
Dollar 1 0 0 0 0
Pound 0 0 0 1 0
Euro 0 1 1 0 1
Fuzzy Relations
• Characteristic functions of crisp relations can be generalized to allow degrees of membership
• A fuzzy relation is a fuzzy set defined over the cartesian product of crisp sets
• Fuzzy relations can be defined using membership functions
• The membership grade denotes the strength of the relationship between the elements of the tuple
Example
• C = {NYC, Paris, Beijing, Madrid}
Distance (Km) NYC Paris Beijing Madrid
NYC 0 5850 11019 5779
Paris 5850 0 8238 1050
Beijing 11019 8238 0 9241
Madrid 5779 1050 9241 0
Projections of a Fuzzy Relation
• Let R be a fuzzy relation defined over X1×X2×…×XN
• Let E = {X1, X2, …, XN} and Y⊂E
• Let Y={Xi, Xj}, i, j ≤ N, i≠j
• We define SY(y), y∈Xi×Xj as:
{X Xi, j}
(
i, j) { 1, , N | i i, j j}
S y y = z K z ∈ R z = y z = y
• Thus, we define the projection of a relation R over a subset Y⊂E as follows:
( )
max( )( )
z SY y
R Y y R z
↓ = ∈
Example
• Let X1={0, 1}, X2={0, 1}, X3={0, 1, 2}
• Let R be a fuzzy relation defined as follows:
X1 X2 X3 R(x1, x2, x3)
0 0 0 0.4
0 0 1 0.9
0 0 2 0.2
0 1 0 1.0
0 1 1 0
0 1 2 0.8
X1 X2 X3 R(x1, x2, x3)
1 0 0 0.5
1 0 1 0.3
1 0 2 0.1
1 1 0 0
1 1 1 0.5
1 1 2 1.0
• Calculate R ↓{X X1, 2}
(
y y1, 2)
Cylindric Extensions of a Fuzzy Relation
• Cylindric extensions can be seen as inverse operations to projections
• Let E = {X1, X2, …, XN} and Y⊂E
• Let R be a fuzzy relation defined over the cartesian product over all sets in Y
• The cylindric extension of R to set E-Y is defined as:
[ R ↑ − E Y ]( < x
1, K , x
N> = ) R y ( )
– If Y = {Xi, Xj} then y = < xi, xj >
Example
• Let X1={0, 1}, X2={0, 1}, X3={0, 1, 2}
• Let R be a fuzzy relation defined as follows:
X2 X3 R(x2, x3)
0 0 0.5
0 1 0.9
0 2 0.2
1 0 1
1 1 0.5
1 2 1
• Calculate R ↑ { }X1
(
x x x1, 2, 3)
Cylindric Closure
• It is not always possible to recover the original relation from the cylindric extension of one of its projections
– Information is lost when a fuzzy relation is replaced by any of its projections
• Sometimes it can be reconstructed from the intersection of a set of its projections
– This intersection is called “the cylindric closure”
– Not always possible to fully recover the relation
Example
• It is not always possible to recover the original relation from the cylindric extension
• There is no guaranty that a cylindric closure exists, either
Exercise (Homework)
1. Calculate all the different projections over the relation in slide 6 (Km distances)
2. Calculate the cylindric extension for each projection
3. Determine if it is possible to recover the original relation (i.e., if a cylindric closure exists)
Binary Fuzzy Relations
• Binary relations are generalized mathematical functions
• The main difference:
– Relations may assign to each value of X two or more elements from Y
• Thus, some basic operations over functions also apply to binary relations
Domain of a Binary Fuzzy Relation
• We define the domain of a binary fuzzy relation R(X,Y) as the fuzzy set:
( )
( ) max , Dom R x y Y R x y
= ∈
• Example:
{ }0,1 , {0,1, 2}
0 1 0 0.3 0.7
1 1 0.4
2 0.6 0
X Y
R
= =
=
( ) 1 / 0 .7 / 1 Dom R x = +
Range of a Binary Fuzzy Relation
• The range of a binary fuzzy relation is defined as the fuzzy set:
( ) max ( , )
x X
Ran R y R x y
= ∈
• Example:
{ }0,1 , {0,1, 2}
0 1 0 0.3 0.7
1 1 0.4
2 0.6 0
X Y
R
= =
=
( ) .7 / 0 1/ 1 .6 / 2 Ran R x = + +
Height of a Binary Fuzzy Relation
• The height of R(x, y) is a number defined by
( ) max max ( , )
y Y x X
h R R x y
∈ ∈
=
• h(R) is the largest membership grade in the relation
{ }0,1 , {0,1, 2}
0 1 0 0.3 0.7
1 1 0.4
2 0.6 0
X Y
R
= =
=
( ) 1 h R =
Inverse of a Fuzzy Binary Relation
• The inverse of given fuzzy relation R is defined as follows
1( , ) ( , ) R− y x = R x y
• Example:
{ }0,1 , {0,1, 2}
0 1 0 0.3 0.7
1 1 0.4
2 0.6 0
X Y
R
= =
=
1
0 1 2
0 0.3 1 0.6
1 0.7 0.4 0 R− =
Composition of Binary Fuzzy Relations
• Given two relations R1(X, Y) and R2(Y, Z) with a common set (Y), we define their standard
composition as:
[ 1 2] ( 1 2 )
( , ) ( , ) max min ( , ), ( , R x z R R x z y Y R x y R y z
= o = ∈
• Properties of THIS composition (max, min):
• Associative
• R-1(z,x)=R2-1(z, y) • R1-1(y, x)
• It is not commutative!!!
Easing the calculation of compositions J
• Calculating a compound relation is just the same as performing matrix multiplication
– We just swap:
• The product for the min
• The sum for the max
• Example:
1
2
0 1 2 0 0.2 1 0 ( , )
1 0.4 0 0.7 1 3 0 0.2 0.1 ( , ) 1 0.4 0
2 1 0
R x y
R y z
=
=
1 3 0 0.4 0.1 ( , )
1 0.7 0.1 R x z =