private void buttonRun_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; textBoxResult.Clear(); Matrix <double> testSetInput, testSetOutput; CreateTestingSet(out testSetInput, out testSetOutput); testSetPredictedOutcome = network.Forward(testSetInput); NetworkGraphics.ToTreeView(treeView1, network); NetworkGraphics.ToPictureBox(pictureBox1, network, 400, 0); textBoxResult.AppendText(dataSet.ProcessTestSetResults(testSetInput, testSetOutput, testSetPredictedOutcome)); Cursor.Current = Cursors.Default; }
private void buttonRunCase_Click(object sender, EventArgs e) { if (network.IsTrained && dataSet.GetType() == typeof(IrisFlowerDataSets)) { Cursor.Current = Cursors.WaitCursor; var caseSet = new DataSet[1]; caseSet[0] = new IrisFlower(Convert.ToDouble(textBoxSL.Text), Convert.ToDouble(textBoxSW.Text), Convert.ToDouble(textBoxPL.Text), Convert.ToDouble(textBoxPW.Text), IrisFlower.IrisSpecies.Unknown); textBoxResult.Clear(); Matrix <double> runCaseInput = dataSet.CreatePropertiesMatrixFromSet(caseSet); Matrix <double> predicted = network.Forward(runCaseInput); textBoxResult.AppendText(DataSet.ClassifyOutput(predicted.Column(0), NetworkGraphics.OutputNames, caseSet[0])); NetworkGraphics.ToTreeView(treeView1, network); NetworkGraphics.ToPictureBox(pictureBox1, network, 400, 0); Cursor.Current = Cursors.Default; } }
private void buttonTrain_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; Matrix <double> trainingSetInput, trainingSetOutput; CreateTrainingSet(out trainingSetInput, out trainingSetOutput); textBoxResult.Clear(); //////////////////////Configure Network/////////////////////////// List <int> hiddenLayersWidth = new List <int>(); hiddenLayersWidth.Add(3); network.EpochsIterations = 1000000; network.Alpha = 0.005; //network.Momentum = 0.1; network.UseNeuronBias = false; ////////////////////////////////////////////////////////////////// var watch = System.Diagnostics.Stopwatch.StartNew(); network.TrainNetwork(trainingSetInput, trainingSetOutput, hiddenLayersWidth); watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; //Console.WriteLine("Elapsed Training Time (ms): " + elapsedMs); //For Debug purposes NetworkGraphics.ToTreeView(treeView1, network); NetworkGraphics.ToPictureBox(pictureBox1, network, 400, 0); buttonRun.Enabled = network.IsTrained; buttonRunCase.Enabled = network.IsTrained && (dataSet.GetType() == typeof(IrisFlowerDataSets)); buttonGenerate.Enabled = network.IsTrained && (dataSet.GetType() == typeof(IrisFlowerDataSets)); buttonExport.Enabled = network.IsTrained; Cursor.Current = Cursors.Default; }