Exemplo n.º 1
0
 private void Initialise()
 {
     outputs = new Neuron[length,length];
     for (int i = 0; i < length; i++)
     {
         for (int j = 0; j < length; j++)
         {
             outputs[i, j] = new Neuron(i, j, length);
             outputs[i, j].Weights = new double[dimensions];
             for (int k = 0; k < dimensions; k++)
             {
                 outputs[i, j].Weights[k] = rnd.NextDouble();
             }
         }
     }
 }
Exemplo n.º 2
0
 public double UpdateWeights(double[] pattern, Neuron winner, int it)
 {
     double sum = 0;
     for (int i = 0; i < Weights.Length; i++)
     {
         double delta = LearningRate(it)*Gauss(winner, it)*(pattern[i] - Weights[i]);
         Weights[i] += delta;
         sum += delta;
     }
     return sum/Weights.Length;
 }
Exemplo n.º 3
0
 private double Gauss(Neuron win, int it)
 {
     double distance = Math.Sqrt(Math.Pow(win.X - X, 2) + Math.Pow(win.Y - Y, 2));
     return Math.Exp(-Math.Pow(distance, 2)/(Math.Pow(Strength(it), 2)));
 }
Exemplo n.º 4
0
        private double Gauss(Neuron win, int it)
        {
            double distance = Math.Sqrt(Math.Pow(win.X - X, 2) + Math.Pow(win.Y - Y, 2));

            return(Math.Exp(-Math.Pow(distance, 2) / (Math.Pow(Strength(it), 2))));
        }