public void TestMain() { var path = NUnit.Framework.TestContext.CurrentContext.TestDirectory + "\\TestResult\\AidaRefTest2\\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } Random r = new Random(); IHistogram1D h1 = new Histogram1D("AIDA 1D Histogram", 40, -3, 3); for (int i = 0; i < 10000; i++) { h1.Fill(r.NextDouble()); } IHistogram2D h2 = new Histogram2D("AIDA 2D Histogram", 40, -3, 3, 40, -3, 3); for (int i = 0; i < 10000; i++) { h2.Fill(r.NextDouble(), r.NextDouble()); } // Write the results as a PlotML files! writeAsXML(h1, path + "test1_aida1.xml"); writeAsXML(h2, path + "test1_aida2.xml"); // Try some projections writeAsXML(h2.ProjectionX, path + "test1_projectionX.xml"); writeAsXML(h2.ProjectionY, path + "test1_projectionY.xml"); }
public TKohonenMap() : base() { this.en8Br1nJcm = (TNeuralDataSet)null; this.NZFB8Hsyyk = (Histogram2D)null; this.lHWBj2LFHb = (Graph)null; this.L2kBAuWI5g = this.yem372767; }
private void P2odmXxb0() { this.x0pBGNZNEv = new TInputNeuron[this.fNInput]; for (int index = 0; index < this.fNInput; ++index) { this.x0pBGNZNEv[index] = new TInputNeuron(); } this.C4gBBYR9YW = new TKohonenNeuron[this.crqUrCA6J, this.R00zPKwYO]; for (int Col = 0; Col < this.crqUrCA6J; ++Col) { for (int Row = 0; Row < this.R00zPKwYO; ++Row) { this.C4gBBYR9YW[Col, Row] = new TKohonenNeuron(this, Col, Row); } } for (int index1 = 0; index1 < this.fNInput; ++index1) { for (int index2 = 0; index2 < this.crqUrCA6J; ++index2) { for (int index3 = 0; index3 < this.R00zPKwYO; ++index3) { this.C4gBBYR9YW[index2, index3].Connect((TNeuron)this.x0pBGNZNEv[index1]); } } } this.NZFB8Hsyyk = (Histogram2D)null; this.lHWBj2LFHb = (Graph)null; this.M7SYu5gxf = EKohonenTopology.Rectangular; this.a8fxHLKhg = EKohonenKernel.Bubble; this.g5ykpFFS7 = 0.05; this.yem372767 = 10.0; }
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 static void TestMain2() { var path = NUnit.Framework.TestContext.CurrentContext.TestDirectory + "\\TestResult\\AidaRefTest2\\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } double[] bounds = { -30, 0, 30, 1000 }; Random r = new Random(); IHistogram1D h1 = new Histogram1D("AIDA 1D Histogram", new VariableAxis(bounds)); //IHistogram1D h1 = new Histogram1D("AIDA 1D Histogram",2,-3,3); for (int i = 0; i < 10000; i++) { h1.Fill(r.NextDouble()); } IHistogram2D h2 = new Histogram2D("AIDA 2D Histogram", new VariableAxis(bounds), new VariableAxis(bounds)); //IHistogram2D h2 = new Histogram2D("AIDA 2D Histogram",2,-3,3, 2,-3,3); for (int i = 0; i < 10000; i++) { h2.Fill(r.NextDouble(), r.NextDouble()); } //IHistogram3D h3 = new Histogram3D("AIDA 3D Histogram",new VariableAxis(bounds),new VariableAxis(bounds),new VariableAxis(bounds)); IHistogram3D h3 = new Histogram3D("AIDA 3D Histogram", 10, -2, +2, 5, -2, +2, 3, -2, +2); for (int i = 0; i < 10000; i++) { h3.Fill(r.NextDouble(), r.NextDouble(), r.NextDouble()); } // Write the results as a PlotML files! writeAsXML(h1, path + "test2_aida1.xml"); writeAsXML(h2, path + "test2_aida2.xml"); writeAsXML(h3, path + "test2_aida3.xml"); // Try some projections writeAsXML(h2.ProjectionX, path + "test2_projectionX.xml"); writeAsXML(h2.ProjectionY, path + "test2_projectionY.xml"); }