Application Center - Maplesoft

App Preview:

Fuzzy Sets in Examples

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

Learn about Maple
Download Application




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 E  is some (universal) set , x - an element of E,`in`(x, E), R - some property. A usual subset A  of set E*(`subset`(A, E)) which  elements satisfy the properties RNULL, is defined as a set of ordered pairs A = {x, `μA`(x)} where `μA`(x) is the characteristic function, i.e.  the so-called affiliation (membership) function, which takes the value

 `μA`(x)NULL=1 if  the properties R satisfies or `μA`(x)NULL=0NULL otherwise.  

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

The maximum value that can accept this function  sup[`in`(x, E)]*`μA`(x) on the fuzzy subset, is called as height of fuzzy subset. Normal are called fuzzy subsets of the identity height sup[`in`(x, E)]*`μA`(x) = 1  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 E = (1, 2, 3, () .. (), 90)NULLthat corresponds to the age of patients of a hospital in years. Then fuzzy subset A = `⊂`("Youth", E)  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"

mu_A := piecewise(25 < x, 1/(1+((1/5)*x-5)^2), 1)

(2.1)

here  x- 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 B = `&sub;`(" Veterans", E)  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);

piecewise(x < 65, 1/(1+(13/2-(1/10)*x)^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 A is into other fuzzy set `subset`(A, B) if for any element `in`(x, E)  is true such inequality

`&mu;A`(x) <= `&mu;B`(x)*`&Iukcy;`

Especially A = Bif  `&mu;A`(x) = `&mu;B`(x) for any `in`(x, E) .

This inequality does not be true for all elements of Eand both above mentioned fuzzy subsets (A="Youth" and B="Veterans"). Therefore no one of them is into other, but both are in EA&sub;E, B&sub;E, because evidently `&equiv;`(`&mu;E`(x), 1)for any `in`(x, E).

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

μconjugate(A)(x)=1-muA(x)    (II)

for all `in`(x, E).

Let us create plots of affilation functions for fuzzy sets A = "Youth", B = "Veterans" ``and conjugate(A) = "Non-Youth", conjugate(B) = "Non-Veterans" ``

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 B = "Veterans" does not coincide with the fuzzy set  conjugate(A) = "Non-Youth", though their affiliation (membership) functions quite similar in the range x > 65.

3.The iIntersection of two fuzzy sets (```intersect`(A, B)) is  the fuzzy set which affiliation function  is defined as

`intersect`(`&mu;A`, B(x)) = min(`&mu;A`(x), `&mu;B`(x))    (III)``

The combination (union) of two fuzzy sets (`union`(A, B)) is the fuzzy set with affiliation function

`union`(`&mu;A`, B(x)) = max(`&mu;A`(x), `&mu;B`(x))    (IV)``

 

The following figures show the relevant affiliation functions of the intersection and  the union of two fuzzy sets A = "Youth"and B = "Veterans"

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 (A+B) and (A.B) product.  The corresponding affiliation functions are determined as:

`&mu;AB`(x) = `&mu;A`(x)*`&mu;B`(x)    (V)``

for product of two fuzzy sets.

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

(mu(A+B))(x) = `&mu;A`(x)+`&mu;B`(x)-`&mu;A`(x)*`&mu;B`(x)       (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 R:  x>>y x, `in`(y, -infinity, infinity), 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);

mu_R := piecewise(y < x, 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 R x>>y  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  `in`(x, A1) ( with  0<muA(x)<1) then `in`(y, B)1 ( with  0<muB(y)<1)              (VI)``

here A1, B1 - some fuzzy sets with matching affiliation functions respectively.

This fuzzy predicate rule in our example can be formulated nearly so:

If`in`(x, A) and A = "Youth"  (with muA(x)->1) then  `in`(y, N) and N = "Normal blood pressure"  (with  muN(y)->1)``      (VII)

In other words, if the patient belongs to a fuzzy subset A = "Youth", then it is likely he also belongs to the fuzzy subset N = "Normal blood pressure". 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

 

 

``