public override void Train(int NumberOfIteration) { Random Randomizer = new Random(); ListShuffler Shuffler = new ListShuffler(); Shuffler.Shuffle(Points, Randomizer); double CurrentError = 0; foreach (Point TargetPoint in Points) { this.SetTargetPoints(TargetPoint); LambdaParameter = MaxRange * Math.Pow(MinRange / MaxRange, NumberOfIteration / (double)EpochsCount); Winner = this.SeekForWinner(); NeuronsToChange = this.GetNeuronsToChange(); this.SetNeuronPotential(NumberOfIteration); CurrentError += Winner.CalculateDistanceFrom(TargetPoint); this.UpdateWeights(NumberOfIteration, TargetPoint); } foreach (Neuron Neuron in Neurons) { Neuron.UpdatePositions(Neuron.GetWeight(0), Neuron.GetWeight(1)); } Errors.Add(new Point(NumberOfIteration, CurrentError / Points.Count())); }
public override void Train(int Iteration) { Shuffler.Shuffle <Point>(Points, Randomizer); double error = 0.0; for (int i = 0; i < Points.Count(); i++) { Point Target = Points[i]; this.SetTargetPoint(Target); Shuffler.NeuronListSort(Neurons); Winner = Neurons[0]; error += Neurons[0].CalculateDistanceFrom(Points[i]); this.UpdateWeights(Iteration, Target); Neurons[0].AddPointInNeuronArea(Target); } foreach (Neuron Neuron in Neurons) { Neuron.UpdatePositions(Neuron.GetWeight(0), Neuron.GetWeight(1)); } Errors.Add(new Point(Iteration, error / Points.Count())); if (Iteration == 0) { Pointparser Outlet = new Pointparser(); Output(Outlet, "G:\\OutputsFromGasNetwork", Iteration); } if (Iteration == 9) { Pointparser Outlet = new Pointparser(); Output(Outlet, "G:\\OutputsFromGasNetwork", Iteration); } if (Iteration == 49) { Pointparser Outlet = new Pointparser(); Output(Outlet, "G:\\OutputsFromGasNetwork", Iteration); } if (Iteration == 100) { Pointparser Outlet = new Pointparser(); Output(Outlet, "G:\\OutputsFromGasNetwork", Iteration); } if (Iteration == 499) { Pointparser Outlet = new Pointparser(); Output(Outlet, "G:\\OutputsFromGasNetwork", Iteration); } }