C++ Neural Networks and Fuzzy Logic:FAM: Fuzzy Associative Memory
Develop Concurrently for Multiple Environments
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
C++ Neural Networks and Fuzzy Logic
(Publisher: IDG Books Worldwide, Inc.)
Author(s): Valluru B. Rao
ISBN: 1558515526
Publication Date: 06/01/95
Search this book:
Previous
Table of Contents
Next
Example of Encoding
Suppose the two fuzzy sets we use to encode have the fit vectors ( 0.3, 0.7, 0.4, 0.2) and (0.4, 0.3, 0.9). Then the matrix W is obtained by using maxmin composition as follows.
0.3 [0.4 0.3 0.9] min(0.3,0.4) min(0.3,0.3) min(0.3,0.9) 0.3 0.3 0.3
W=0.7 =min(0.7,0.4) min(0.7,0.3) min(0.7,0.9)=0.4 0.3 0.7
0.4 min(0.4,0.4) min(0.4,0.3) min(0.4,0.9) 0.4 0.3 0.4
0.2 min(0.2,0.4) min(0.2,0.3) min(0.2,0.9) 0.2 0.2 0.2
Recall for the Example
If we input the fit vector (0.3, 0.7, 0.4, 0.2), the output (b1, b2, b3) is determined as follows, using bj = max( min(a1, w1j),
, min(am, wmj), where m is the dimension of the a fit vector, and wij is the ith row, jth column element of the matrix W.
b1 = max(min(0.3, 0.3), min(0.7, 0.4), min(0.4, 0.4),
min(0.2, 0.2)) = max(0.3, 0.4, 0.4, 0.2) = 0.4
b2 = max(min(0.3, 0.3), min(0.7, 0.3), min(0.4, 0.3),
min(0.2, 0.2)) = max( 0.3, 0.3, 0.3, 0.2 ) = 0.3
b3 = max(min(0.3, 0.3), min(0.7, 0.7), min(0.4, 0.4),
min(0.2, 0.2)) = max (0.3, 0.7, 0.4, 0.2) = 0.7
The output vector (0.4, 0.3, 0.7) is not the same as the second fit vector used, namely (0.4, 0.3, 0.9), but it is a subset of it, so the recall is not perfect. If you input the vector (0.4, 0.3, 0.7) in the opposite direction, using the transpose of the matrix W, the output is (0.3, 0.7, 0.4, 0.2), showing resonance. If on the other hand you input (0.4, 0.3, 0.9) at that end, the output vector is (0.3, 0.7, 0.4, 0.2), which in turn causes in the other direction an output of (0.4, 0.3, 0.7) at which time there is resonance. Can we foresee these results? The following section explains this further.
Recall
Let us use the operator o to denote maxmin composition. Perfect recall occurs when the weight matrix is obtained using the maxmin composition of fit vectors U and V as follows:
(i) U o W = V if and only if height (U) ≥ height (V).
(ii) V o WT = U if and only if height (V) ≥ height (U).
Also note that if X and Y are arbitrary fit vectors with the same dimensions as U and V, then:
(iii) X o W ∴ V.
(iv) Y o WT ∴ U.
A ∴ B is the notation to say A is a subset of B.
In the previous example, height of (0.3, 0.7, 0.4, 0.2) is 0.7, and height of (0.4, 0.3, 0.9) is 0.9. Therefore (0.4, 0.3, 0.9) as input, produced (0.3, 0.7, 0.4, 0.2) as output, but (0.3, 0.7, 0.4, 0.2) as input, produced only a subset of (0.4, 0.3, 0.9). That both (0.4, 0.3, 0.7) and (0.4, 0.3, 0.9) gave the same output, (0.3, 0.7, 0.4, 0.2) is in accordance with the corollary to the above, which states that if (X, Y) is a fuzzy associated memory, and if X is a subset of X, then (X, Y) is also a fuzzy associated memory.
C++ Implementation
We use the classes we created for BAM implementation in C++, except that we call the neuron class fzneuron, and we do not need some of the methods or functions in the network class. The header file, the source file, and the output from an illustrative run of the program are given in the following. The header file is called fuzzyam.hpp, and the source file is called fuzzyam.cpp.
Program details
The program details are analogous to the program details given in Chapter 8. The computations are done with fuzzy logic. Unlike in the nonfuzzy version, a single exemplar fuzzy vector pair is used here. There are no transformations to bipolar versions, since the vectors are fuzzy and not binary and crisp.
A neuron in the first layer is referred to as anrn, and the number of neurons in this layer is referred to as anmbr. bnrn is the name we give to the array of neurons in the second layer and bnmbr denotes the size of that array. The sequence of operations in the program are as follows:
We ask the user to input the exemplar vector pair.
We give the network the X vector, in the exemplar pair. We find the activations of the elements of bnrn array and get corresponding output vector as a binary pattern. If this is the Y in the exemplar pair, the network has made a desired association in one direction, and we go on to the next.step. Otherwise we have a potential associated pair, one of which is X and the other is what we just got as the output vector in the opposite layer. We say potential associated pair because we have the next step to confirm the association.
We run the bnrn array through the transpose of the weight matrix and calculate the outputs of the anrn array elements. If, as a result, we get the vector X as the anrn array, we found an associated pair, (X, Y). Otherwise, we repeat the two steps just described until we find an associated pair.
We now work with the next pair of exemplar vectors in the same manner as above, to find an associated pair.
We assign serial numbers, denoted by the variable idn, to the associated pairs so we can print them all together at the end of the program. The pair is called (X, Y) where X produces Y through the weight matrix W, and Y produces X through the weight matrix, which is the transpose of W.
A flag is used to have value 0 until confirmation of association is obtained, when the value of the flag changes to 1.
Functions compr1 and compr2 in the network class verify if the potential pair is indeed an associated pair and set the proper value of the flag mentioned above.
Functions comput1 and comput2 in the network class carry out the calculations to get the activations and then find the output vector, in the respective directions of the fuzzy associative memory network.
A lot of the code from the bidirectional associative memory (BAM) is used for the FAM. Here are the listings, with comments added where there are differences between this code and the code for the BAM of Chapter 8.
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-1999 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permision of EarthWeb is prohibited.
Wyszukiwarka
Podobne podstrony:
220 223 (2)220 223 o5l6c2nfxg6ely66wr7yeiieytpxi7idwm4ku7y220 223223 227 6fcwctb2pglckpptczkjmjgfc6sdcxsk6lmqcjiWhirpool AWZ 220 D222 22304 (220)Carolyn Kephart The Hearts Desire (epub) id 220WCE2012 pp218 223220 289Rebelde 220 odc 5223 228Mazowieckie Studia Humanistyczne r1997 t3 n1 s211 223223 232więcej podobnych podstron