Application Center - Maplesoft

# Fuzzy Sets in Examples

You can switch back to the summary page by clicking here.

Fuzzy sets in examples

G.P. Chuiko

Petro Mohyla BlackSea State University, Mykolayiv,Ukraine

gp47@mail.ru

 Introduction This worksheet has been created first as a practical part of  short course on the pattern recognition theory for my students. It had intended to their introduce, including visually impressions, with fuzzy sets and basic rules of simple operations with them. MAPLE tools were  extremely comfortable for such a task and this experience may be useful for community colleagues.

Fuzzy sets in two examples

Suppose that   is some (universal) set ,  - an element of ,,  - some property. A usual subset   of set  which  elements satisfy the properties , is defined as a set of ordered pairs  where  is the characteristic function, i.e.  the so-called affiliation (membership) function, which takes the value

=1 if  the properties  satisfies or  otherwise.

Fuzzy subset differs from normal (usual) only what there is no single answer "Yes-No" for elements about properties   when the affiliation function accepts only two values: either 1 or 0.  Fuzzy subset  of universal set   is defined as the set of ordered pairs   where  is affiliation function of the  subsetelement  that now can take a value in the range .  Affiliation function indicates the degree of belonging of element to fuzzy suset: from  i.e. the item is guaranteed not to be into suset up to  i.e item is guaranteed to be into subset .  If  then the element most likely belongs to the fuzzy subset  than does not belong to it. Elements , for which , called "jump points" of fuzzy subset . [1]

The maximum value that can accept this function   on the fuzzy subset, is called as height of fuzzy subset. Normal are called fuzzy subsets of the identity height   If the height of fuzzy subset is smaller of units, it is called as subnormal.  A fuzzy subset is empty if neither the element does have non-zero affiliation function.

Let set that corresponds to the age of patients of a hospital in years. Then fuzzy subset   can be determined by using the some affiliation function, for instance

 > restart:
 > mu_A:=piecewise(x>25,1/(1+((x-25)/5)^2),1);# Affiliation function to fuzzy subset "Youth"
 (2.1)

here  - the age of a patient.  The "jump point" obviously corresponds to age  x = 30. Let us to illustrate the function (2.1) as a plain 2D graphics

 > plot([mu_A,0.5],x=0..90,0..1.1,axes=boxed,gridlines=true,thickness=[3,2],color=[blue,black],font=[helvetica,14],linestyle=[solid,dashdot],caption=[`Fig.1 Affiliation function of the fuzzy subset А="Youth"`]);

Here is the same function as the density plot where the white points represents unity and the black points - zero values of them

 > plots[densityplot](mu_A,x=0..90,y=0..1,tickmarks=[15,0],style = PATCHNOGRID,font=[helvetica,14],caption=[`Fig.2 Affiliation function of the fuzzy subset А="Youth"`],transparency=0.2,axes=boxed);

Between the bright and dark areas in the density plot, there has been some "grey area"-smooth transition from close to the units to almost zero features. A clear boundary between fuzzy subset of "Youth" and the rest of the patients of course could not be observed.

The affiliation function was given by analytical expression (2.1) in this example. However, there are practiced also other ways to define the functions of the fuzzy subset, such as tabular method, the method of comparison for each element, graphic techniques, etc.

We will introduce another fuzzy subset   in which accumulate elderly patients. The affiliation function will be determinate by such expression

 > mu_B:=piecewise(x<65, 1/(1+((65-x)/10)^(2)),1);
 (2.2)
 > plot([mu_B,0.5],x=0..90,0..1.1,axes=boxed,gridlines=true,thickness=[3,2],color=[red,black],font=[helvetica,14],linestyle=[solid,dashdot],caption=[`Fig.3 Affiliation function of the fuzzy subset В ="Veterans"`]);
 > plots[densityplot](mu_B,x=0..90,y=0..1,tickmarks=[15,0],style = PATCHNOGRID,font=[helvetica,14],caption=[`Fig.4 Affiliation function of the fuzzy subset В ="Veterans"`],transparency=0.2,axes=boxed);

Operations with fuzzy sets

Logic operations

1. They say that the fuzzy set  is into other fuzzy set  if for any element   is true such inequality

Especially if   for any  .

This inequality does not be true for all elements of and both above mentioned fuzzy subsets (A="Youth" and B="Veterans"). Therefore no one of them is into other, but both are in because evidently for any .

2. They say also that fuzzy set  is addition to the fuzzy set   if  their  affiliation functions are linked as follows:

μ   (II)

for all .

Let us create plots of affilation functions for fuzzy sets  and

 > plot([mu_A,1-mu_A,mu_B,1-mu_B,0.5],x=0..90,0..1.1,axes=boxed,gridlines=true,thickness=[3,3,3,3,2],color=[blue,navy,red, orange,black],font=[helvetica,14],linestyle=[solid,dashdot,solid,dashdot,dash],caption=[`Fig.5 Affiliation functions `],legend=[`A`,`non-А`,`B`,`non-В`,`1/2`]);

The plot clearly shows that the fuzzy set  does not coincide with the fuzzy set  , though their affiliation (membership) functions quite similar in the range

3.The iIntersection of two fuzzy sets () is  the fuzzy set which affiliation function  is defined as

(III)

The combination (union) of two fuzzy sets () is the fuzzy set with affiliation function

()

The following figures show the relevant affiliation functions of the intersection and  the union of two fuzzy sets and

 > plot([min(mu_A,mu_B),max(mu_A,mu_B),0.5],x=0..90,0..1.1,axes=boxed,gridlines=true,thickness=[3,3,3,2],color=[blue,red,black],font=[helvetica,14],linestyle=[solid,solid,dashdot],caption=[`Fig.6 Affiliation functions of intersect and union of fuzzy sets A and B`],legend =[`intersection`,`union`,`1/2`]);
 > plots[densityplot](min(mu_A,mu_B),x=0..90,y=0..1,tickmarks=[15,0],style = PATCHNOGRID,font=[helvetica,14],caption=[`Рис.7 Affiliation function of intersection of A and B`],transparency=0.175,axes=boxed);
 > plots[densityplot](max(mu_A,mu_B),x=0..90,y=0..1,tickmarks=[15,0],style = PATCHNOGRID,font=[helvetica,14],caption=[`Fig.8 Affiliation function of union of A and B`],transparency=0.2,axes=boxed);

Fig.6 clearly shows that  the inersection of fuzzy sets  is subnormal set because its height is visible smaller than unity.

Algebraic operations

Fuzzy sets allow algebraic operations: sum () and () product.  The corresponding affiliation functions are determined as:

(V)

for product of two fuzzy sets.

The resulting affiliation function look a bit unexpected for the sum of two fuzzy sets:

(VI)

The following figures illustrate the results of both operations.

 > plot([mu_A*mu_B,mu_A+mu_B-mu_A*mu_B,0.5],x=0..90,0..1.1,axes=boxed,gridlines=true,thickness=[3,3,3,2],color=[blue,red,black],font=[helvetica,14],linestyle=[solid,solid,dashdot],caption=[`Fig.9 Affiliation function of sum and product of two fuzzy sets A and B`],legend =[`product`,`sum`,`1/2`]);
 > plots[densityplot](mu_A*mu_B,x=0..90,y=0..1,tickmarks=[15,0],style = PATCHNOGRID,font=[helvetica,14],caption=[`Fig.10 Affiliation function of the product of two fuzzy sets AB`],transparency=0.175,axes=boxed);
 > plots[densityplot](mu_A+mu_B-mu_A*mu_B,x=0..90,y=0..1,tickmarks=[15,0],style = PATCHNOGRID,font=[helvetica,14],caption=[`Fig.11 ffiliation function of the sum of two fuzzy sets A+B`],transparency=0.2,axes=boxed);

The comparison of  Fig.10,11 with Fig.7,8 is usefull.

Fuzzy relations and fuzzy conclusions

Binary fuzzy relation

Let us consider for example a binary relation  , i.e. fuzzy relation of arrangement "much more" on the namber axis. Such fuzzy relation may be defined by some binary affiliation (membership) function, for instance:

 > mu_R:=piecewise(x>y,1/(1+(1/(x-y)^2)),0);
 (4.1.1)
 > plots[densityplot](mu_R,x=-10..10,y=-10..10,tickmarks=[10,10],style = PATCH,labelfont=[helvetica,14],caption=[`Fig.12 Affiliation function of binary fuzzy relation R: x >> y`],transparency=0.25,axes=normal,font=[helvetica,14]);

The boundary of fuzzy relation  is evidently "foggy". The degree of fuzziness depends obviously on the actual affiliation function (4.1.1).

 Fuzzy conclusions Fuzzy comclusions are based on the course system of fuzzy predicate rules similar to the following: If   ( with  0< then 1 ( with  0<          (VI) here  - some fuzzy sets with matching affiliation functions respectively. This fuzzy predicate rule in our example can be formulated nearly so:   (with then    (with        (VII) In other words, if the patient belongs to a fuzzy subset , then it is likely he also belongs to the fuzzy subset . Thus, these two fuzzy sets substantially overlap. Someone could say that in the old good days the same old and good doctors did and more desperate forecasts without all this mathematics. And this is right with respect to the old good  doctors, but not for their computers that should relieve them of life and work.
 References [1]   Zadeh, L. A., Fuzzy sets. Information and Control, Vol. 8, pp. 338–353. (1965). [2]  Willamder. N.  Fuzzy sets. Fuzzy logic. Available by adresse  http://teormin.ifmo.ru/courses/intro/21.pdf (2004)

Legal Notice:  Maplesoft and Maple are trademarks of Waterloo Maple Inc. Neither Maplesoft nor the authors are responsible for any errors contained within and are not liable for any damages resulting from the use of this material.  This application is intended for non-commercial, non-profit use only. Contact the authors for permission if you wish to use this application in for-profit activities