# 126.

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

#### Fuzzy Queries

At this point, our digression from the discussion of fuzzy data bases is finished. Let us now recall, for immediate reference, the entries in the definitions we listed earlier in Table 16.3:

Table 16.3 Fuzzy Values for Example Sets

Fuzzy Value Set
FV(age) { very young, young, somewhat old, old }
FV(nov) { never, rarely, quite a few, often, very often }
FV(lov) { barely few days, few days, quite a few days, many days }
FV(yov) {distant past, recent past, recent }
FV(hs) { barely, adequately, quite a bit, extensively }
FV(flp) {not proficient, barely proficient, adequate, proficient, very proficient }

If you refer to Tables 16.1 and 16.3, you will see that a fuzzy query defines a fuzzy set. For example, suppose you ask for a list of young people with enough knowledge of Italy, and who know Italian almost like a native. You want the intersection of the fuzzy sets, age_young, hs_adequately, and flp_very proficient. John Smith is in the fuzzy set age_young with a 0.75 degree of membership, as noted before. Suppose he is in hs_adequately with a 0.2 degree of membership, and in flp_very proficient with a 0.9 degree of membership. We then put him in the fuzzy set for this query. The degree of membership for John Smith is the smallest value among 0.75, 0.2, and 0.9, since we are taking the intersection of fuzzy sets. So 0.2/John Smith will be part of the enumeration of the query fuzzy set.

Note that you can use unknown in place of the value of an attribute for an item in the database. If you do not know John Smith’s age, you can enter unknown in that field of John Smith’s record. You may say his age is unknown, even though you have a rough idea that he is about 35. You would then be able to assign some reasonable degrees of membership of John Smith in fuzzy sets like age_young or age_somewhat old.

#### Extending Database Models

One way of extending a model into a fuzzy model, as far as databases are concerned, is to make use of similarity relations and to extend the operations with them as Buckles and Perry do, such as PROJECT. First there are the domains, for the database. In our example relating to travel and tour guides above, the domains are:

D1 = { John Smith, ... }, the set of persons included in the database,
D2 = {India, Italy, Japan, ... }, the set of countries of visit,
D3 = {Hindi, Italian, Japanese, ... }, the set of foreign languages,
D4 = {U.S., ... }, the set of countries of citizenship,
D5 = set of ages,
D6 = set of years,
D7 = set of number of visits,
D8 = set of length of visits.

Note that the enumerated sets are shown with ‘...’ in the sets, to indicate that there may be more entries listed, but we are not giving a complete list. In practice, you will make a complete enumeration unlike in our example. The domains D5, D6, D7, and D8 can also be given with all their elements listed, since in practice, these sets are finite. Conceptually though, they are infinite sets; for example, D6 is the set of positive integers.

Next, you have the similarity relations that you define. And then there are the operations.

#### Example

Consider a standard database given below. It can be called also the relation R1, from set D1 = {Georgette, Darrell, Ernie , Grace } to set D2 = {Spanish, Italian, French, Japanese, Chinese, Russian} as shown in Table 16.4:

Table 16.4 Example for Relation R1, with Domains D1 and D2

D1 D2
Georgette Spanish
Georgette Italian
Darrell French
Darrell Spanish
Darrell Japanese
Ernie Spanish
Ernie Russian
Grace Chinese
Grace French

Let’s say a fuzzy database has D1 and D2 as domains. Suppose you have a similarity relation S1 on domain D1 given by the matrix:

`           1     0.4   0.8   0.7           0.4   1     0.5   0.3           0.8   0.5   1     0.4           0.7   0.3   0.4   1 `

Recall that the entries in this matrix represent the degrees of membership of ordered pairs in the relation S1. For example, the first row third column element, which is 0.8, in the matrix refers to the degree of membership of the pair (Georgette, Ernie), since the rows and columns refer to Georgette, Darrell, Ernie and Grace in that order.