public void DrawMesh(int X, int Y) { for (int index1 = 0; index1 < this.crqUrCA6J; ++index1) { for (int index2 = 0; index2 < this.R00zPKwYO; ++index2) { TKohonenNeuron tkohonenNeuron1 = this.C4gBBYR9YW[index1, index2]; if (index1 < this.crqUrCA6J - 1) { TKohonenNeuron tkohonenNeuron2 = this.C4gBBYR9YW[index1 + 1, index2]; new TLine(tkohonenNeuron1.GetWeight(X).Weight, tkohonenNeuron1.GetWeight(Y).Weight, tkohonenNeuron2.GetWeight(X).Weight, tkohonenNeuron2.GetWeight(Y).Weight) { Color = Color.Blue }.Draw(); } if (index2 < this.R00zPKwYO - 1) { TKohonenNeuron tkohonenNeuron2 = this.C4gBBYR9YW[index1, index2 + 1]; new TLine(tkohonenNeuron1.GetWeight(X).Weight, tkohonenNeuron1.GetWeight(Y).Weight, tkohonenNeuron2.GetWeight(X).Weight, tkohonenNeuron2.GetWeight(Y).Weight) { Color = Color.Blue }.Draw(); } new TMarker(tkohonenNeuron1.GetWeight(X).Weight, tkohonenNeuron1.GetWeight(Y).Weight, 20.0) { Color = Color.Red }.Draw(); } } }
public void Update(TKohonenNeuron Neuron) { double neighborhoodFunction = this.GetNeighborhoodFunction(Neuron); foreach (TNeuralWeight tneuralWeight in this.weights) { tneuralWeight.Weight = tneuralWeight.Weight + this.vOHKkfFcp.LearningRate * neighborhoodFunction * (tneuralWeight.GetInput() - tneuralWeight.Weight); } }
public double GetDistance(TKohonenNeuron Neuron) { if (Neuron == this) { return(0.0); } else { return(Math.Sqrt((double)((this.WKXIlHax4 - Neuron.Col) * (this.WKXIlHax4 - Neuron.Col) + (this.uiQQufIMH - Neuron.Row) * (this.uiQQufIMH - Neuron.Row)))); } }
public Histogram2D GetMapHist() { this.NZFB8Hsyyk = new Histogram2D(this.fName, this.fTitle, this.crqUrCA6J, 0.0, (double)this.crqUrCA6J, this.R00zPKwYO, 0.0, (double)this.R00zPKwYO); for (int index1 = 0; index1 < this.crqUrCA6J; ++index1) { for (int index2 = 0; index2 < this.R00zPKwYO; ++index2) { this.C4gBBYR9YW[index1, index2].ResetWin(); } } for (int Seek = 0; Seek < this.en8Br1nJcm.GetNData(); ++Seek) { TKohonenData tkohonenData = (TKohonenData)this.en8Br1nJcm.GetData(Seek); double[] input = tkohonenData.Input; double[] output = tkohonenData.Output; this.ProcessInput(input); TKohonenNeuron winner = this.GetWinner(); if (output != null) { if (output[0] != 0.0) { winner.AddWin(output[0]); } } else { winner.AddWin(1.0); winner.SetNWins(1); } tkohonenData.X = winner.Col; tkohonenData.Y = winner.Row; } for (int index1 = 0; index1 < this.crqUrCA6J; ++index1) { for (int index2 = 0; index2 < this.R00zPKwYO; ++index2) { TKohonenNeuron tkohonenNeuron = this.C4gBBYR9YW[index1, index2]; if (tkohonenNeuron.GetNWins() != 0) { this.NZFB8Hsyyk.Set((double)tkohonenNeuron.Col, (double)tkohonenNeuron.Row, tkohonenNeuron.GetWin() / (double)tkohonenNeuron.GetNWins()); } else { this.NZFB8Hsyyk.Set((double)tkohonenNeuron.Col, (double)tkohonenNeuron.Row, 0.0); } } } return(this.NZFB8Hsyyk); }
public double GetNeighborhoodFunction(TKohonenNeuron Neuron) { if (Neuron == this) return 1.0; double distance = this.GetDistance(Neuron); double neighborhoodRadius = this.vOHKkfFcp.NeighborhoodRadius; switch (this.vOHKkfFcp.Kernel) { case EKohonenKernel.Bubble: return distance <= neighborhoodRadius ? 1.0 : 0.0; case EKohonenKernel.Gauss: return Math.Exp(-distance * distance / (neighborhoodRadius * neighborhoodRadius)); default: return 0.0; } }
public void TrainThread() { this.fNPattern = 0; for (int index = 0; (double)index < this.fSParameter; ++index) { this.fInput = this.en8Br1nJcm.GetData().Input; this.ProcessInput(this.fInput); this.oGkBVEIgUD = this.GetWinner(); this.Update(); TKohonenMap tkohonenMap = this; int num1 = tkohonenMap.fNPattern + 1; tkohonenMap.fNPattern = num1; double num2 = (double)this.fNPattern / this.fSParameter; this.fLearningRate = this.g5ykpFFS7 * (1.0 - num2); this.L2kBAuWI5g = 1.0 + this.yem372767 * (1.0 - num2); } Console.WriteLine(this.fNPattern); }
public TKohonenNeuron GetWinner() { TKohonenNeuron tkohonenNeuron = this.C4gBBYR9YW[0, 0]; double num = tkohonenNeuron.GetError(); for (int index1 = 0; index1 < this.crqUrCA6J; ++index1) { for (int index2 = 0; index2 < this.R00zPKwYO; ++index2) { double error = this.C4gBBYR9YW[index1, index2].GetError(); if (error < num) { num = error; tkohonenNeuron = this.C4gBBYR9YW[index1, index2]; } } } return(tkohonenNeuron); }
public double GetNeighborhoodFunction(TKohonenNeuron Neuron) { if (Neuron == this) { return(1.0); } double distance = this.GetDistance(Neuron); double neighborhoodRadius = this.vOHKkfFcp.NeighborhoodRadius; switch (this.vOHKkfFcp.Kernel) { case EKohonenKernel.Bubble: return(distance <= neighborhoodRadius ? 1.0 : 0.0); case EKohonenKernel.Gauss: return(Math.Exp(-distance * distance / (neighborhoodRadius * neighborhoodRadius))); default: return(0.0); } }
public void Update(TKohonenNeuron Neuron) { double neighborhoodFunction = this.GetNeighborhoodFunction(Neuron); foreach (TNeuralWeight tneuralWeight in this.weights) tneuralWeight.Weight = tneuralWeight.Weight + this.vOHKkfFcp.LearningRate * neighborhoodFunction * (tneuralWeight.GetInput() - tneuralWeight.Weight); }
public double GetDistance(TKohonenNeuron Neuron) { if (Neuron == this) return 0.0; else return Math.Sqrt((double) ((this.WKXIlHax4 - Neuron.Col) * (this.WKXIlHax4 - Neuron.Col) + (this.uiQQufIMH - Neuron.Row) * (this.uiQQufIMH - Neuron.Row))); }
public void TrainThread() { this.fNPattern = 0; for (int index = 0; (double) index < this.fSParameter; ++index) { this.fInput = this.en8Br1nJcm.GetData().Input; this.ProcessInput(this.fInput); this.oGkBVEIgUD = this.GetWinner(); this.Update(); TKohonenMap tkohonenMap = this; int num1 = tkohonenMap.fNPattern + 1; tkohonenMap.fNPattern = num1; double num2 = (double) this.fNPattern / this.fSParameter; this.fLearningRate = this.g5ykpFFS7 * (1.0 - num2); this.L2kBAuWI5g = 1.0 + this.yem372767 * (1.0 - num2); } Console.WriteLine( this.fNPattern); }