public double TarinNetwork(float[][] inputs, float[][] outputs, int samplingCellsCount, int inputNeuronsCount, int outputNeuronsCount, int hiddenLayerNeuronsCount, double learningRate, int iterations, System.Windows.Forms.Label labelTrainTest, System.Windows.Forms.Label labelTrainningAccuracy, System.Windows.Forms.Label labelValidationAccuracy, ZedGraphControl zedGraphControl) { network = new ActivationNetwork( new SigmoidFunction(), inputNeuronsCount, hiddenLayerNeuronsCount, outputNeuronsCount); ParallelResilientBackpropagationLearning teacher = new ParallelResilientBackpropagationLearning(network); teacher.LearningRate = learningRate; double[][] trainInput = GeneralOpertor.GetArray(inputs, 0.8, true, inputNeuronsCount); double[][] testInput = GeneralOpertor.GetArray(inputs, 0.8, false, inputNeuronsCount); double[][] trainOutput = GeneralOpertor.GetArray(outputs, 0.8, true, outputNeuronsCount); double[][] testOutput = GeneralOpertor.GetArray(outputs, 0.8, false, outputNeuronsCount); int iteration = 0; double error = 1; zedGraphControl.GraphPane.CurveList.Clear(); PointPairList list = new PointPairList(); while ((error > 0.01) && (iteration <= iterations)) { error = teacher.RunEpoch(trainInput, trainOutput) * 2 / samplingCellsCount; if (iteration == 0) { list.Add(iteration, error); zedGraphControl.GraphPane.AddCurve("Error", list, System.Drawing.Color.FromArgb(255, 0, 0)); zedGraphControl.GraphPane.AxisChange(); } else if ((iteration % 30 == 0) || (iteration == iterations)) { zedGraphControl.GraphPane.CurveList[0].AddPoint(iteration, error); zedGraphControl.GraphPane.AxisChange(); labelTrainTest.Text = "Iteration:" + iteration + ", Error:" + error.ToString("0.00000"); Application.DoEvents(); } zedGraphControl.Refresh(); iteration++; } double accuracy = GetAccuracy(trainInput, trainOutput, network); labelTrainningAccuracy.Text = (accuracy * 100).ToString("0.000") + " %"; accuracy = GetAccuracy(testInput, testOutput, network); labelValidationAccuracy.Text = (accuracy * 100).ToString("0.000") + " %"; return(error); }