public Backpropagation(Perceptron perceptron, Data.LearningParam param) { this.perceptron = perceptron; this.param = param; layers = perceptron.Size; int n = perceptron.MaxLayerSize; w = new double[layers, n, n]; w1 = new double[layers, n, n]; endthread = true; }
private void _learnButton_Click(object sender, EventArgs e) { Data.LearningParam param = new Data.LearningParam(); String inputName = this._comboInputLearnData.Text, outputName; outputName = this._comboOutputLearnData.Text; this._tboxError.Text = ""; try { if (((List<double[]>)data[inputName])[0].Length != perceptron.getLayer(0).Size) throw new Exception("Wrong input data size"); if (((List<double[]>)data[outputName])[0].Length != perceptron.getLayer(perceptron.Size-1).Size) throw new Exception("Wrong output data size"); } catch(Exception ex) { MessageBox.Show(ex.Message, "Warning"); return; } try { //check if size of input and output data is proper param.Input = (List<double[]>)data[inputName]; param.Output = (List<double[]>)data[outputName]; param.Alpha = Double.Parse(this._tboxAlpha.Text); param.Epsilon = Double.Parse(this._tboxEpsilon.Text); if (this._radioDiffTeta.Checked == true) param.OneTeta = false; else param.OneTeta = true; param.Teta = Double.Parse(this._tboxTeta.Text); if (this._radioEarlyStop.Checked == true) { param.EarlyStop = true; param.LearnSet = double.Parse(this._tboxLearnSet.Text); param.ValidateSet = double.Parse(this._tboxValidateSet.Text); param.TestSet = double.Parse(this._tboxTestSet.Text); } else { param.EarlyStop = true; param.KFoldSamples = int.Parse(this._tboxKFold.Text); } backprop.Param = param; backprop.TBoxError = this._tboxError; backprop.StartButton= this._buttonLearn; backprop.ContinueButton = this._buttonContinueLearn; backprop.StopButton = this._buttonStopLearn; backprop.StartLearn(); } catch(Exception ex) { Console.Out.WriteLine(ex.Message); MessageBox.Show("Some learning problem has occured", "Warning"); } }