Esempio n. 1
0
        private INeuronWeights GenerateWeights(uint passedNumberOfWeights)
        {
            IList <INeuronWeight> WeightsList = new List <INeuronWeight>((int)passedNumberOfWeights);

            for (int i = 0; i < passedNumberOfWeights; i++)
            {
                WeightsList.Add(CreateRandomNeuronWeight());
            }

            INeuronWeights result = new NeuronWeights(WeightsList);

            return(result);
        }
Esempio n. 2
0
 public void Teach(bool result)
 {
     if (result == false)
     {
         for (var y = 0; y <= NeuronWeights.GetUpperBound(1); y++)
         {
             for (var x = 0; x <= NeuronWeights.GetUpperBound(0); x++)
             {
                 NeuronWeights[x, y] += InputData[x, y];
             }
         }
     }
     else
     {
         for (var y = 0; y <= NeuronWeights.GetUpperBound(1); y++)
         {
             for (var x = 0; x <= NeuronWeights.GetUpperBound(0); x++)
             {
                 NeuronWeights[x, y] -= InputData[x, y];
             }
         }
     }
 }