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(); } } } }
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; }
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))); }
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)))); }