I am learning how to use Hopfield Neural network as a context addressable memory. The objective is to obtain a fixed point of the network which indicates an equilibrium state. This state vector remains unchanged for successive iterations and is called a fixed point. When the network reaches the fixed point, we say that a decision or goal has been reached. As can be seen from below illustration, by recursive application of the formula, X2 is the fixed point.
WeightMatrix = [0.0 0.0 -1 0 1; 0.0 0.0 0 -1 0; 0.0 -1 0.0 0 -1; -1 1.0 0.0 0.0 0.0; 0.0 0.0 0.0 1 0.0]; X1 = (1 0 0 0 0) %Initial training example X1*W = [0,0,-1,0,1]; X2 = f(X1*W) = [1,0,0,0,1] X2*W = [0,0,-1,1,1]; X3 = f(X2*W) = [1,0,0,1,1] X3*W = [-1,1,-1,1,1]; X4 = f(X3*W) = [1,1,0,1,1] X4*W = [-1,1,-1,0,1]; X5 = f(X4*W) = [1,1,0,0,1] X5*W = [0,0,-1,0,1]; X6 = f(X5*W) = [1,0,0,0,1] = X6 = **X2**
Problem : The above example is based on the paper Download link titled "Application study in decision support with fuzzy cognitive map" explains how to train a [Fuzzy Cognitive Map] with this example in Section 2.2. When I simulated the example, using the same logistic sigmoid thresholding function
logistic sigmoid function f(X1*W) = 1/(1+exp(-X1*W).
, I am not getting the same output after passing the result into the thresholding function as mentioned in the paper. As a result, the program/network is iterating millions of time and not converging to a fixed point. By passing the result of X1*W into f, I am getting real valued numbers for X2 and not binary !! Same problem for the rest of the iterations.
Is there something wrong in my understanding of how convergence/memory recall is performed or is my code incorrect? Please help
Training1 = [1,0,0,0,0]; lambda =1; t = 1; X(t,:) = Training1; err = 1; while(err~=0) Out = X(t,:)*WeightMatrix; temp = 1./(1+exp(-lambda.*Out)); err = ((Out - temp)*(Out - temp).')/numel(temp); t = t+1 X(t,:) = temp; end