Beispiel #1
0
 // build the neural network. Fills the arrays with neurons and connect them.
 void build()
 {
     for (int i = 0; i < entryLevel.Length; i++)
     {
         entryLevel[i] = new neuron(length, outputLength);
     }
     for (int i = 0; i < numOfneuronsRows; i++)
     {
         for (int j = 0; j < length; j++)
         {
             if (i != numOfneuronsRows - 1)
             {
                 neurons[i, j] = new neuron(length, outputLength);
             }
             else
             {
                 neurons[i, j] = new neuron(outputLength, outputLength);
             }
         }
     }
     for (int i = 0; i < entryLevel.Length; i++)
     {
         for (int j = 0; j < length; j++)
         {
             entryLevel[i].neuronsOutFill(neurons[0, j], j);
         }
     }
     for (int i = 0; i < numOfneuronsRows; i++)
     {
         for (int j = 0; j < length; j++)
         {
             if (i != numOfneuronsRows - 1)
             {
                 for (int z = 0; z < length; z++)
                 {
                     neurons[i, j].neuronsOutFill(neurons[i + 1, z], z);
                 }
             }
         }
     }
     for (int i = 0; i < outputLevel.Length; i++)
     {
         outputLevel[i] = new neuron(outputLength, outputLength);
         for (int j = 0; j < length; j++)
         {
             neurons[numOfneuronsRows - 1, j].neuronsOutFill(outputLevel[i], i);
         }
     }
 }
Beispiel #2
0
 // fills a neuron slot in the 'neuronsOut' array with a given neuron. The slot position is also given.
 public void neuronsOutFill(neuron x, int place)
 {
     neuronsOut[place] = x;
 }