# 124.

 C++ Neural Networks and Fuzzy Logic by Valluru B. Rao M&T Books, IDG Books Worldwide, Inc. ISBN: 1558515526   Pub Date: 06/01/95

Now let us determine the fuzzy sets that have John Smith as an element, besides possibly others. We need the values of degrees of membership for John Smith (actually his attribute values) in various fuzzy sets. Let us pick them as follows:

` ——————————————————————————————————————————————————————————————————————————  Age:   mvery young(35) = 0 (degree of membership of 35 in very young is 0.                           We will employ this notation from now on).         myoung(35) = 0.75         msomewhat old(35) = 0.3         mold(35) = 0 —————————————————————————————————————————————————————————————————————————— `

Assume that similar values are assigned to the degrees of membership of values of John Smith’s attributes in other fuzzy sets. Just as John Smith’s age does not belong in the fuzzy sets young and old, some of his other attribute values do not belong in some of the other fuzzy sets. The following is a list of fuzzy sets in which John Smith appears:

` age_young = {0.75/35, ...} age_somewhat old = {0.3/35, ... } `

A similar statement attempted for the number of visits may prompt you to list nov_rarely = {0.7/1, 0.2/2}, and nov_quite a few = {0.3/2, .6/3, ...}. But you readily realize that the number of visits by itself does not mean much unless it is referenced with the country of visit. A person may visit one country very often, but another only rarely. This suggests the notion of a fuzzy relation, which is also a fuzzy set.

NOTE:  What follows is an explanation of relations and discussion of fuzzy relations. If you want to skip this part for now, you may go to the “Fuzzy Queries” section a few pages later in this chapter.

#### Fuzzy Relations

A standard relation from set A to set B is a subset of the Cartesian product of A and B, written as A×B. The elements of A×B are ordered pairs (a, b) where a is an element of A and b is an element of B. For example, the ordered pair (Joe, Paul) is an element of the Cartesian product of the set of fathers, which includes Joe and the set of sons which includes Paul. Or, you can consider it as an element of the Cartesian product of the set of men with itself. In this case, the ordered pair (Joe, Paul) is in the subset which contains (a, b, if a is the father of b. This subset is a relation on the set of men. You can call this relation “father.”

A fuzzy relation is similar to a standard relation, except that the resulting sets are fuzzy sets. An example of such a relation is ‘much_more_educated’. This fuzzy set may look something like,

` much_more_educated = { ..., 0.2/(Jeff, Steve), 0.7/(Jeff, Mike), ... } `

#### Matrix Representation of a Fuzzy Relation

A fuzzy relation can be given as a matrix also when the underlying sets, call them domains, are finite. For example, let the set of men be S = { Jeff, Steve, Mike }, and let us use the same relation, much_more_educated. For each element of the Cartesian product S×S, we need the degree of membership in this relation. We already have two such values, mmuch_more_educated(Jeff, Steve) = 0.2, and mmuch_more_educated(Jeff, Mike) = 0.7. What degree of membership in the set should we assign for the pair (Jeff, Jeff)? It seems reasonable to assign a 0. We will assign a 0 whenever the two members of the ordered pair are the same. Our relation much_more_educated is given by a matrix that may look like the following:

`                       0/(Jeff, Jeff)   0.2/(Jeff, Steve)  0.7/(Jeff, Mike)  much_more_educated = 0.4/(Steve, Jeff)  0/(Steve, Steve) 0.3/(Steve, Mike)                       0.1/(Mike, Jeff) 0.6/(Mike, Steve)    0/(Mike, Mike) `

NOTE:  Note that the first row corresponds to ordered pairs with Jeff as the first member, second column corresponds to those with Steve as the second member, and so on. The main diagonal has ordered pairs where the first and second members are the same.