public double UpdateWeights(double[] pattern, KohonenNeuron 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(KohonenNeuron 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)))); }