Artifical Intelligence Notes Part 5
Artifical Intelligence Notes Part 5
ARTIFICAL INTELLIGENCE
PART 4
Fuzzy Set Theory
• The word "fuzzy" means "vagueness". Fuzziness occurs when the boundary of a piece of information is
not clear-cut.
• Fuzzy sets have been introduced by Lotfi A. Zadeh (1965) as an extension of the classical notion of set.
• Classical set theory allows the membership of the elements in the set in binary terms, a bivalent condition
- an element either belongs or does not belong to the set.
Fuzzy set theory permits the gradual assessment of the membership of elements in a set,
described with the aid of a membership function valued in the real unit interval [0, 1].
• Example:
Human thinking and reasoning frequently involve fuzzy information, originating from inherently
inexact human concepts. Humans, can give satisfactory answers, which are probably true.
However, our systems are unable to answer many questions. The reason is, most systems are
designed based upon classical set theory and two-valued logic which is unable to cope with
unreliable and incomplete information and give expert opinions.
•
A Set is any well defined collection of objects. An object in a set is called an element or
member of that set.
− Sets are defined by a simple statement describing whether a particular element having a certain property
belongs to that particular set.
A = { a1 , a2 , a3 , a4 , . . . . an }
1 if x ∈ X µA (x)
=
0 otherwise
Α : Χ → [0, 1]
A(x) = 1 , x is a member of A Eq.(1)
A(x) = 0 , x is not a member of A
Alternatively, the set A can be represented for all elements x ∈ X by its characteristic
function µA (x) defined as
1 if x ∈ X µA (x) =
Eq.(2) 0 otherwise
− Thus in classical set theory µA (x) has only the values 0 ('false') and 1 ('true''). Such sets are called crisp
sets.
•
Fuzzy Set Theory
Fuzzy set theory is an extension of classical set theory where elements have varying
degrees of membership. A logic based on the two truth values, True and False, is sometimes
inadequate when describing human reasoning. Fuzzy logic uses the whole interval between 0
(false) and 1 (true) to describe human reasoning.
− A Fuzzy Set is any set that allows its members to have different degree of membership, called
− Fuzzy logic is derived from fuzzy set theory dealing with reasoning that is approximate rather than
precisely deduced from classical predicate logic.
− Fuzzy logic allows in linguistic form the set membership values to imprecise concepts like "slightly", "quite"
and "very".
− As said before, in classical set theory, the characteristic function µA(x) of Eq.(2) has only values 0
('false') and 1 ('true'').
Such sets are crisp sets.
The characteristic function µA(x) of Eq. (2) for the crisp set is generalized for the Non-crisp
sets.
This generalized characteristic function µA(x) of Eq.(2) is called membership function.
0 0
1.8 m Height x 1.8 m Height x
A student of height 1.79m would belong to both tall and not tall sets with a particular degree of
membership.
As the height increases the membership grade within the tall set would increase whilst the
membership grade within the not-tall set would decrease.
• Ca pturing Uncertainty
Instead of avoiding or ignoring uncertainty, Lotfi Zadeh introduced Fuzzy Set theory that captures uncertainty.
Α : Χ → [0, 1]
µc (x) µF (x)
1
C F
0.5
0 x
either out of the set, with membership of degree " 0 ", or in the set,
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }
Set A, as SMALL, has un-sharp boundaries, can be characterized by a function that assigns a
real number from the closed interval from 0 to 1 to each element x in the set X.
Fuzzy Set
A Fuzzy Set is any set that allows its members to have different degree of membership, called
membership function, in the interval [0 , 1].
A fuzzy set A, defined in the universal space X, is a function defined in X which assumes values
in the range [0, 1].
The value A(x) is the membership grade of the element x in a fuzzy set A.
Note that a fuzzy set can be defined precisely by associating with each x , its grade of membership
in SMALL.
Originally the universal space for fuzzy sets in fuzzy logic was defined only on the integers.
Now, the universal space for fuzzy sets and fuzzy relations is defined with three numbers.
The first two numbers specify the start and end of the universal space, and the third argument
specifies the increment between elements.
This gives the user more flexibility in choosing the universal space.
Example : The fuzzy set of numbers, defined in the universal space
X = { xi } = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} is presented as
SetOption [FuzzySet, UniversalSpace → {1, 12, 1}]
Fuzzy Membership
A fuzzy set A defined in the universal space X is a function defined in X which assumes values
in the range [0, 1].
The value A(x) is the degree of membership of the element x in a fuzzy set A.
The Graphic Interpretation of fuzzy membership for the fuzzy sets : Small, Prime Numbers,
Universal-space, Finite and Infinite
UniversalSpace, and Empty are illustrated in the next few slides.
The fuzzy set SMALL of small numbers, defined in the universal space
X = { xi } = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} is presented as
SetOption [FuzzySet, UniversalSpace → {1, 12, 1}]
.6
.4
.2
0
0 1 2 3 4 5 6 7 8 9 10 11 12 X
Fig Graphic Interpretation of Fuzzy Sets PRIME
•
Graphic Interpretation of Fuzzy Sets UNIVERSALSPACE
In any application of sets or fuzzy sets theory, all sets are subsets of a fixed set called universal space or universe
of discourse denoted by X.
Universal space X as a fuzzy set is a function equal to 1 for all elements.
The fuzzy set UNIVERSALSPACE numbers, defined in the universal space X = { xi } = {1,
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} is presented as SetOption [FuzzySet, UniversalSpace → {1, 12, 1}]
UNIVERSALSPACE = FuzzySet {{1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}, {6, 1},
{7, 1}, {8, 1}, {9, 1}, {10, 1}, {11, 1}, {12, 1}}
.6
.4
.2
0
0 1 2 3 4 5 6 7 8 9 10 11 12 X
Fig Graphic Interpretation of Fuzzy Set UNIVERSALSPACE
Examples:
1. Let N be the universal space of the days of the week.
N = {Mo, Tu, We, Th, Fr, Sa, Su}. N is finite.
2. Let M = {1, 3, 5, 7, 9, ...}. M is infinite.
3. Let L = {u | u is a lake in a city }. L is finite.
(Although it may be difficult to count the number of lakes in a city, but L is still a
finite universal set.)
.6
.4
.2
0
0 1 2 3 4 5 6 7 8 9 10 11 12 X
Fig Graphic Interpretation of Fuzzy Set EMPTY
Fuzzy Operations
A fuzzy set operations are the operations on fuzzy sets. The fuzzy set operations are
generalization of crisp set operations. Zadeh [1965] formulated the fuzzy set theory in the terms
of standard operations: Complement, Union, Intersection, and Difference.
In this section, the graphical interpretation of the following standard fuzzy set terms and the Fuzzy
Logic operations are illustrated:
• Inclusion
Let A and B be fuzzy sets defined in the same universal space X. The fuzzy set A is included in
the fuzzy set B if and only if for every x in the set X we have A(x) ≤ B(x) Example :
The fuzzy set UNIVERSALSPACE numbers, defined in the universal space X = { xi } =
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} is presented as SetOption [FuzzySet, UniversalSpace → {1, 12, 1}]
SMALL = FuzzySet {{1, 1 }, {2, 1 }, {3, 0.9}, {4, 0.6}, {5, 0.4}, {6, 0.3},
{7, 0.2}, {8, 0.1}, {9, 0 }, {10, 0 }, {11, 0}, {12, 0}}
Example 1:
Let A = {{a, 1}, {b, 1}, {c, 0}} and B = {{a, 1},
{b, 1}, {c, 1}}.
Then A is comparable to B, since A is a subset of B.
Example 2 :
Let C = {{a, 1}, {b, 1}, {c, 0.5}} and D = {{a, 1},
{b, 0.9}, {c, 0.6}}.
Then C and D are not comparable since
C is not a subset of D and D is
not a subset of C.
• Equality
Let A and B be fuzzy sets defined in the same space X. Then A and
B are equal, which is denoted X = Y if and only if for all x in the set
X, A(x) = B(x).
Example.
The fuzzy set B SMALL
SMALL = FuzzySet {{1, 1 }, {2, 1 }, {3, 0.9}, {4, 0.6}, {5, 0.4}, {6, 0.3},
{7, 0.2}, {8, 0.1}, {9, 0 }, {10, 0 }, {11, 0}, {12, 0}}
0 1 2 3 4 5 6 7 8 9 10 11 12 X
Fig Graphic Interpretation of Fuzzy Equality
FuzzyPlot [SMALL, STILLSMALL]
Note : If equality A(x) = B(x) is not satisfied even for one element x in the set X, then we say that A
is not equal to B.
•
Complement
0 1 2 3 4 5 6 7 8 9 10 11 12 X
Example 2.
The empty set Φ and the universal set X, as fuzzy sets, are complements of one another.
Φ' = X , X' = Φ
The fuzzy set B EMPTY
Empty = FuzzySet {{1, 0 }, {2, 0 }, {3, 0}, {4, 0}, {5, 0}, {6, 0},
{7, 0}, {8, 0}, {9, 0 }, {10, 0 }, {11, 0}, {12, 0}}
The fuzzy set A UNIVERSAL
Universal = FuzzySet {{1, 1 }, {2, 1 }, {3, 1}, {4, 1}, {5, 1}, {6, 1},
{7, 1}, {8, 1}, {9, 1 }, {10, 1 }, {11, 1}, {12, 1}}
0 1 2 3 4 5 6 7 8 9 10 11 12 X
Fig Graphic Interpretation of Fuzzy Compliment FuzzyPlot [EMPTY,
UNIVERSALSPACE]
Union
A(x) = 0.6 and B(x) = 0.4 ∴ (A ∪ B)(x) = max [0.6, 0.4] = 0.6
.8
.6
.4
.2
0
0 1 2 3 4 5 6 7 8 9 10 11 12 X Fig Graphic
Interpretation of Fuzzy Union
FuzzyPlot [UNION]
The notion of the union is closely related to that of the connective "or".
Let A is a class of "Young" men, B is a class of "Bald" men.
If "David is Young" or "David is Bald," then David is associated with the union of A and B.
Implies David is a member of A ∪ B.
•
Intersection
Let A and B be fuzzy sets defined in the space X. Intersection is defined as the greatest fuzzy
set that include both A and B. Intersection of A and B is denoted by A ∩ B. The following
relation must be satisfied for the intersection operation : for all x in the set X, (A ∩ B)(x) =
Min (A(x), B(x)).
Fuzzy Intersection : (A ∩ B)(x) = min [A(x), B(x)] for all x ∈ X
A(x) = 0.6 and B(x) = 0.4 ∴ (A ∩ B)(x) = min [0.6, 0.4] = 0.4
.8
.6
.4
.2
0
0 1 2 3 4 5 6 7 8 9 10 11 12 X
Fig Graphic Interpretation of Fuzzy Union
FuzzyPlot [INTERSECTION]
•
Difference
.8
.6
.4
.2
0
0 1 2 3 4 5 6 7 8 9 10 11 12 X
Fig Graphic Interpretation of Fuzzy Union
FuzzyPlot [UNION]
Fuzzy Properties
•
Properties Related to Union
The properties related to union are :
Identity, Idempotence, Commutativity and Associativity.
■ Identity: A∪Φ =A
input = Equality [SMALL ∪ EMPTY , SMALL] output = True
A∪X=X
input = Equality [SMALL ∪ UnivrsalSpace , UnivrsalSpace] output =
True
■ Idempotence :
A∪A=A
input = Equality [SMALL ∪ SMALL , SMALL] output = True
■ Commutativity :
A∪B =B∪A
input = Equality [SMALL ∪ MEDIUM, MEDIUM ∪ SMALL] output = True
■ Associativity:
A ∪ (B∪ C) = (A∪ B) ∪ C
input = Equality [Small ∪ (Medium ∪ Big) , (Small ∪ Medium) ∪ Big] output = True
Fuzzy Set Small , Medium , Big
Small = FuzzySet {{1, 1 }, {2, 1 }, {3, 0.9}, {4, 0.6}, {5, 0.4}, {6, 0.3},
{7, 0.2}, {8, 0.1}, {9, 0.7 }, {10, 0.4 }, {11, 0}, {12, 0}}
Medium = FuzzySet {{1, 0 }, {2, 0 }, {3, 0}, {4, 0.2}, {5, 0.5}, {6, 0.8},
{7, 1}, {8, 1}, {9, 0 }, {10, 0 }, {11, 0.1}, {12, 0}}
Big = FuzzySet [{{1,0}, {2,0}, {3,0}, {4,0}, {5,0}, {6,0.1}, {7,0.2}, {8,0.4},
{9,0.6}, {10,0.8}, {11,1}, {12,1}}]
(3) Small ∪ (Medium ∪ Big) = FuzzySet [{1,1},{2,1}, {3,0.9}, {4,0.6}, {5,0.5}, {6,0.8}, {7,1},
{8, 1}, {9, 0.7}, {10, 0.8}, {11, 1}, {12, 1}]
A∩Φ =Φ
input = Equality [Small ∩ Empty , Empty] output = True
■ Identity :
A∩ X=A
input = Equality [Small ∩ UnivrsalSpace , Small] output = True
■ Idempotence :
A∩ A=A
input = Equality [Small ∩ Small , Small] output = True
■ Commutativity :
A∩ B=B∩ A
input = Equality [Small ∩ Big , Big ∩ Small] output = True
■ Associativity :
A ∩ (B ∩ C) = (A ∩ B) ∩ C
input = Equality [Small ∩ (Medium ∩ Big), (Small ∩ Medium) ∩ Big] output = True
•
Add itional Properties
■ Distributivity:
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) input = Equality
[Small ∩ (Medium ∪ Big) ,
(Small ∩ Medium) ∪ (Small ∩ Big)] output = True
■ Distributivity:
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) input = Equality
[Small ∪ (Medium ∩ Big) ,
(Small ∪ Medium) ∩ (Small ∪ Big)] output = True
A ∪ A' = X
input = Equality [Small ∪ NotSmall , UnivrsalSpace ] output = True
■ Law of contradiction A ∩ A' = Φ input = Equality [Small ∩
NotSmall , EmptySpace ]
output = True
•
Cartesian Product Of Two Fuzzy Sets
■
Cartesian Product of two Crisp Sets
Let A and B be two crisp sets in the universe of discourse X and Y..
The Cartesian product of A and B is denoted by A x B
Defined as A x B = { (a , b) │ a ∈ A , b ∈ B }
Note : Generally A x B ≠ B x A
Example : Graphic representation of A x B
B
Let A = {a, b, c} and B = {1, 2} then A x B
2
= { (a , 1) , (a , 2) ,
(b , 1) , (b , 2) , 1
(c , 1) , (c , 2) } A
a b c
■
Cartesian product of two Fuzzy Sets
Let A and B be two fuzzy sets in the universe of discourse X and Y.
The Cartesian product of A and B is denoted by A x B
Defined by their membership function µ A (x) and µ B (y) as
Thus the Cartesian product A x B is a fuzzy set of ordered pair (x , y) for all x ∈ X
and y ∈ Y, with grade membership of (x , y) in X x Y given by the above equations .
In a sense Cartesian product of two Fuzzy sets is a Fuzzy Relation.
Fuzzy Relations
− Fuzzy relations offer the capability to capture the uncertainty and vagueness in relations between
sets and elements of a set.
− Fuzzy Relations were introduced to supersede classical crisp relations; It describes the total
presence or absence of association of elements.
In this section, first the fuzzy relation is defined and then expressing fuzzy relations in terms of
matrices and graphical visualizations. Later the properties of fuzzy relations and operations that can
be performed with fuzzy relations are illustrated.
Fuzzy relation is a generalization of the definition of fuzzy set from 2-D space to 3-D
space.
− It gives the degree of membership of the ordered pair (x , y) in R associating with each pair
(x , y) in A x B a real number in the interval [0 , 1].
yx y1 Y2 Y3
R x1 0 0.1 0.2
X2 0.7 0.2 0.3
X3 1 0.6 0.2
where symbol means ' is defined as' and the values in the matrix are the
values of membership function:
1 µ
.8 Note : Since the values of the
.6
.4
.2
membership function 0.7, 1, 0.6
1 2 3
0
are in the direction of x below the
1
− The first item is a list containing element and membership grade pairs, {{v1, w1}, R11},
{{ v1, w2}, R12}, ... , {{ vn, wm}, Rnm}}.
where { v1, w1}, { v1, w2}, ... , { vn, wm} are the elements of the relation are defined as ordered pairs,
and { R11 , R12 , ... , Rnm} are the membership grades of the elements of the relation that range from
0 to 1, inclusive.
− The second item is the universal space; for relations, the universal space consists of a pair of
where the first pair defines the universal space for the first set and the second pair defines the
universal space for the second set. Example showing how fuzzy relations are represented
Let V = {1, 2, 3} and W = {1, 2, 3, 4}.
A fuzzy relation R is, a function defined in the space V x W, which takes values from the
interval [0, 1] , expressed as R : V x W → [0, 1]
R = FuzzyRelation [{{{1, 1}, 1}, {{1, 2}, 0.2}, {{1, 3}, 0.7}, {{1, 4}, 0},
{{2, 1}, 0.7}, {{2, 2}, 1}, {{2, 3}, 0.4}, {{2, 4}, 0.8}, {{3, 1}, 0},
{{3, 2}, 0.6}, {{3, 3}, 0.3}, {{3, 4}, 0.5},
UniversalSpace → {{1, 3, 1}, {1, 4, 1}}]
This relation can be represented in the following two forms shown below Membership matrix
form Graph form
1
µ
.8
w v w1 w2 w3 w4 .6
.4
v1 1 0.2 0.7 0 .2
R 1 2 3 4 w
v2 0.7 1 0.4 0.8 0
v3 0 0.6 0.3 0.5
1
2
3
v
Vertical lines represent membership grades
Elements of fuzzy relation are ordered pairs {vi , wj}, where vi is first and wj is second element. The
membership grades of the elements are represented by the heights of the vertical lines.
Projections of Fuzzy Relations
•
First Projection of R : defined as
(x , y) ∈AxB}
Y
•
Second Projection of R : defined as
, y) ∈AxB}
X
•
Total Projection of R : defined as
max
R(T) = max {µ R (x , y) | (x , y) ∈AxB}
X Y
max
Note : In all these three expression means max with respect to y while x
is considered fixed Y
The Fuzzy Relation R together with First, Second and Total Projection of R are shown
below.
yx y1 y2 y3 y4 Y5 R(1)
Note :
For R(1) select ma x means max with respect to y while x is considered fixed Y
For R(2) select ma x means max with respect to x while y is considered fixed x
R(1)
1
.8
.6
.4
.2
0 x
1 2 3 4 5
R(2)
1
.8
.6
.4
.2
0 y
1 2 3 4 5
Fig Fuzzy plot of 1st projection R(1) Fig Fuzzy plot of 2nd projection R(2)
The operation composition combines the fuzzy relations in different variables, say (x , y) and
(y , z) ; x ∈ A , y ∈ B , z ∈ C .
Consider the relations :
R1(x , y) = { ((x , y) , µR1 (x , y)) | (x , y) ∈ A x B }
R2(y , z) = { ((y , y) , µR1 (y , z)) | (y , z) ∈ B x C }
The domain of R1 is A x B and the domain of R2 is B x C
•
Max-Min Composition
zy z1 z2 z3
yx y1 y2 y3
y1 0.8 0.2 0
x1 0.1 0.3 0
y2 0.2 1 0.6
R1 R2 x2 0.8 1 0.3
y3 0.5 0 0.4
Note : Number of columns in the first table and second table are equal.
Consider row x1 and column z1 , means the pair (x1 , z1) for all yj , j = 1, 2, 3, and perform
min operation
min (µR1 (x1 , y1) , µR2 (y1 , z1)) = min (0.1, 0.8) = 0.1, min (µR1 (x1 , y2) ,
µR2 (y2 , z1)) = min (0.3, 0.2) = 0.2, min (µR1 (x1 , y3) , µR2 (y3 , z1)) = min ( 0,
0.5) = 0,
Step -2 Compute max operation (definition in previous slide).
For x = x1 , z = z1 , y = yj , j = 1, 2, 3,
Calculate the grade membership of the pair (x1 , z1) as { (x1 , z1) , max (
Similarly, find all the grade membership of the pairs (x1 , z2) , (x1 ,
R1 ο R2 = 0.1 0.3 0
x1
x2 0.8 1 0.3
Note : If tables R1 and R2 are considered as matrices, the operation composition resembles the
operation multiplication in matrix calculus linking row by columns. After each cell is occupied
max-min value (the product is replaced by min, the sum is replaced by max).
The min-max composition is similar to max-min composition with the difference that the roll
of max and min are interchanged.
(x , z) ∈ AxC, y∈B
Consider the relations R1(x , y) and R2(y , z) as given by the same relation of previous example
of max-min composition, that is
yx y1 y2 y3 zy z1 z2 z3
After computation in similar way as done in the case of max-min composition, the final
result is
zx z1 z2 z3
R1 R2 = x1 0.3 0 0.1
x2 0.5 0.4 0.4
R1 ο R2 = R1 R2