Reputation: 815
I try to write neural network for pattern recognition with hopfield. I use instructions in Introduction to Neural Networks for C#, Second Edition book , but I don't use his .dll files and write all classes myself.
Jeff Heaton in his book said that for train neural network with hopfield, we should receive input pattern(in matrix form) and then do this 3 steps :
1-Convert binary input to bipolar ( 0 -> (-1) , 1 ->1)
2-Convert input matrix to row matrix(save as M2) , then transpose it(save as M1) , and after them multiply (M3=M1*M2)
3-Add to weight matrix(WeightMatrix+=M3)
My question is about step 2 ! When I convert my 8X8 matrix to row matrix with below code :
int count = 0;
int[] RowMatrix = new int[64];
for(int j=0; j<8;j++)
for (int i = 0; i < 8; i++)
{
RowMatrix[count] = PatternBipolar[i, j];
count++;
}
(PatternBipolar is input pattern that converted to bipolar) We have 1X64 matrix , and when transpose it we have column matrix 64X1. So if we multiply them(ColumnMatrix * RowMatrix as book says) we have 64X64 matrix!!
But our weight matrix is 8X8(Because we have only 64 neurons not 64*64=4096!!! neurons).
so I confused and need help.pleas help me for this problem and about this matrixs..
I receive input matrix with below form, and use windows form :
Upvotes: 2
Views: 1973
Reputation: 815
Finally I find my answer!
In Hopfield network when we use n neuron in our network, we need to nXn weight matrix. We just need to multiply row matrix comes from input, into it's inverse. Then in weight matrix we have relationship between each matrix and others.
Upvotes: 1