NEXYAD


Fuzzy sets : tutorial

Keywords : tutorial, fuzzy sets, fuzzy logic, decision, precision, certainty, possibility, possibility theory, necessity, discrimination, fuzzy decision arrays, applied maths, nexyad

Written by Gerard YAHIAOUI and Pierre DA SILVA DIAS, main founders of the applied maths research company NEXYAD, © NEXYAD, all rights reserved : for any question, please CONTACT
Reproduction of partial or complete content of this page is authorized ONLY if "source : NEXYAD  http://www.nexyad.com" is clearly mentionned.
This tutorial was written for students or engineers that wish to understand main hypothesis and ideas of fuzzy sets.

Vocabulary and main concepts

Some searchers could notice that it is not that easy to translate a "simple" real world situation into maths and automatic computed decision.
Example :
"It is dangerous to come too close to the lion"

                                                       
Indeed, translating the above sentence means choosing a threshold T :
If (distance < T) then danger
One can represent this threshold with the classical sets theory :


Let us consider a very small distance e : then one can see that the membership function varies from 1 to 0 for the 2 very close situations D = T - e, and D = T + e :


Because measurement is made with finite precision, ifever distance to the lion is "about" T (T +- e , where 2.e  is the imprecision), then decision is a random function : it may randomly move from 0 to 1 ... or from 1 to 0 ...
It is important to notice that tolerances on T cannot solve such a problem : tolerance t1 leads to 2 thresholds : (T - t1) and (T + t1). Let's take the first threshold : what happens for T - t1 - e  and T - t1 + ? ... these two situation are very similar (2.e may tend to zero) ... however, decision is completely different (danger, no danger).

Thresholds and chaos :
Let us consider the two following systems :
         
                      system 1                                                                                                     system 2

Back plot is the theoretical trajectory. Red plot is the real trajectory (with imprecision on initial angle).
System 1 :
One can notice that the more the time the worse the prediction precision. But the errors grows in a predictive way among time : there exists a computable value M(t) that verifies : error(t) < M(t)
Such a system is called a "predictable" system. Every one knows such a system : "bilboard game".
System 2 :
The initial trajectory is exactly the same  : system 2 is "predictable" ... until ... it meets the first obstacle : then the trajectory changes completely and suddenly.
For such a system, there is no computable value M(t) : the system is said to be "unpredictable".
In fact, very short term is still predictable, but long term is not.
Let us notice that the obstacle can be considered as a threshold on the angle.
One can see that behaviour of system 2 is "very" sensitive to initial conditions. If sensitivity to initial condition is more demanding than available measurement precision ... then the system is "chaotic" : let us note that such a system is unpredictable however completely deterministic it may be. Every one knows such a system : "pinball game" : short term predictability allows the player to react, long term unpredicability mimics a "random" system that always generates new situations.

The use of thresholds leads to chaotic systems every time that measured values come close to the thresholds.




Continuous membership functions : fuzzy sets

The idea is to use a continuous function as membership function :

Such a set is called a "fuzzy set".
One can demonstrate that most classical sets theory properties are available for fuzzy sets :
 - De Morgan properties :
   

  - :

If the membership function for A is MA, then the membership function for non(A) is (1 - MA)

 - Logical OR (union of two sets) :

NB : in classical sets theory/logic, OR is already the max value :
0   0   0
0   1   1
1   0   1
1   1   1

 - Logical AND (intersection of two sets) :

NB : in classical sets theory/logic, AND is already the min value :
0   0   0
0   1   0
1   0   0
1   1   1

One can consider that fuzzy logic is a generalization of classical logic (slopes of membership functions may tend to infinite). It means that fuzzy logic inherits of every properties of fuzzy logic, but because "classical" logic is a particular case, it leads to particular properties. Let us list the 2 main specific properties of classical logic that we lose in the general case :
 - mutual exclusion of A and non(A) : in fuzzy logic, if membership of the element a to the set A is M(a), then membership of a to non(A) is 1 - M(a) :

NB : in the particular case of "classical" logic, M(a) can take only 2 possible values : 0 or 1.
When M(a) = 1, then  1 -  M(a) = 0; when M(a) = 0, then 1 - M(a) = 1
- union of every sets is NOT Universe :
      




What may be done using fuzzy sets

 - Representation of a concept : example "TALL"

Set of sizes that may be considered as fitting into the concept "TALL"

 - Representation of an imprecise data : example : "about 1,8m" :

Set of sizes of about 1,8m

If both concepts and imprecise data can be represented with fuzzy sets, then "comparing" fuzzy sets will help to "compare" concepts and data : the most used comparison score is the degree of Possibility :

Possibility is the max value of intersection : "possibility for a man of about 1,8m to be tall is 0,6".
A second comparison score (called Necessity) is defined : something is neccessary if the opposite is not possible ...
Possibility is sometimes considered as another way of defining Probability : IT IS COMPLETELY WRONG.
Ideas of Possibility and probability are completely different. Example :
Let us consider 2 feeding bottles :
                                                                                             
beverage 1 :                                                                                   beverage 2 :
probability of being drinkable = 0,9                                             possibility of being drinkable = 0,9

If you have no other choice, which beverage should you give to your baby ? ...

Well, probability = 0,9 means that if you took 10 000 bottles, 9 000 bottles should contain completely drinkable beverage ... But for the 1 000 other bottles ... then drinkability of beverage is not known AT ALL (it may be very dangerous ... or not).
On the contrary, possibility = 0,9 means that the beverage fits into the "completely drinkable" concept with a score of 0,9 : maybe this beverage is not the best one for your baby, but it cannot be dangerous ...

The "Lion" example is also interesting : one could describe the danger through probabilities : in such a "risk" problem, possibility and probability ideas will lead to a rather identical result in a big range of distance, and will lead to completely different results and interpretations of this range. As we explain in the tutorial on "mathematical models", it is the responsability of the engineer to let real world observations fit into mathematical entities.


One could demonstrate that Necessity < Probability < Possibility
"A thing must be possible before becoming probable ... and necessary".

Uncertainty can also be representated by a fuzzy set parameter :



When uncertainty tends to 1, then the membership function tends to be uniform : this can be used in order to build a processing system that may have a variable number of inputs : when inputs aren't available, one can say that uncertainty on their value is 1 : then possibility is always "1". As it is explained further, fusion between several possibilities is generally computed with a "min" function : "1" values have no influence on the result.
This property allows to build easily decision systems that use a variable number of inputs (all inputs are not available at the same time, and non available inputs are sumply "not used"  by the decision making system).



Fuzzy decision arrays

Pattern recognition, defects detection, and decision making, can be implemented in a fuzzy decision array :
input data are first representated with fuzzy sets (the red fuzzy sets below).
then these inputs are compared to a knowledge based representation of every class.
P x K possibility scores are computed : for a given diagnostic (a row of the decision array), the smallest possibility score is the possibility for the diagnostic (ifever the min value is 0, it means that at least 1 possibility is 0 ... and then the data doesn't fit into the concept).
Then one gets K possibility scores (1 for every diagnostic), and the biggest score is the most possible diagnostic.




NB : let us notice that unavailable inputs lead to an uncertainty value of "1", and then possibility  is always "1" too ... computing the min value per row eliminates any influence of the uncertain value ...

Examples of applications :

1 - Fuzzy query :
Let us consider a data base (example : real estate, cars, ...).
It is possible to query through a 1 line decision array : "blue" fuzzy sets are the query, and "red" fuzzy sets are associated to every data line. The min of possibilities is then considered as being the global matching score of a data line.
It is possible to sort data lines among this score.

2 - Pattern recognition :
Var1, Var2, ... are quantitative descriptors of shapes (size, main orientation, texture characteristics, colour, luminance, shape descriptors such a Fourier descriptors, ...).
The decision array has 1 line per class (number of classes = number of different kinds of shapes to recognize)
The "blue" sets are the shapes "profiles".
The line that leads to the biggest possibility is considered as the winner.
The pattern recognition system is able to use a variable number of inputs : every non available input is replaced with a straight line fuzzy set (uncertainty = 1).



Applications

 - decision making / pattern recognition / defects detections (fuzzy decision arrays)
 - data base "fuzzy query"
 - control (fuzzy expert systems)




For more questions or applications, please feel free to contact us