private void ExecuteNeat() { bool wait = false; int inputCount = 2; int outputCount = 1; int delay = 150; Dispatcher.Invoke(() => { controlsToDisable.ForEach(x => x.IsEnabled = false); controlsToEnable.ForEach(x => x.IsEnabled = true); if (CbAnimate.IsChecked == true) { wait = true; } inputCount = int.TryParse(TbInputs.Text, out inputCount) ? inputCount : 2; outputCount = int.TryParse(TbOutputs.Text, out outputCount) ? outputCount : 1; delay = int.TryParse(TbDelay.Text, out delay) ? delay : 0; }); Neat neat = new Neat(); neat.OnGenerationEnd += (a) => { Dispatcher.Invoke(() => { TBSynapseData.Clear(); a.synapses.ForEach(x => { TBSynapseData.Text += "FromLayer: " + x.FromLayer + "\n"; TBSynapseData.Text += "Fromneuron: " + x.FromNeuron + "\n"; TBSynapseData.Text += "ToLayer: " + x.ToLayer + "\n"; TBSynapseData.Text += "ToNeuron: " + x.ToNeuron + "\n"; TBSynapseData.Text += "Weight: " + x.Weight + "\n"; TBSynapseData.Text += "\n"; }); TBNeuronData.Clear(); a.hiddenNeurons.ForEach(x => { TBNeuronData.Text += "Layer: " + x.Layer + "\n"; TBNeuronData.Text += "NeuronPosition: " + x.NeuronPosition + "\n"; TBNeuronData.Text += "Bias: " + x.Bias + "\n"; TBNeuronData.Text += "\n"; }); TBOutputNeurons.Clear(); a.outputNeurons.ToList().ForEach(x => { TBOutputNeurons.Text += "Value: " + x.Value + "\n"; TBOutputNeurons.Text += "\n"; }); }); if (wait) { DrawAnn(a); Thread.Sleep(delay); } while (pause) { } neat.LowerWaitFlag(); }; string[] inputColumns = new string[] { //"movie_title", "genres", "director_name", "budget", }; string[] expectedOutputColumns = new string[] { "gross", }; NormalizedDataAndDictionaries inputData = GetDataFromDatabase(inputColumns); NormalizedDataAndDictionaries outputData = GetDataFromDatabase(expectedOutputColumns); //Ann ann = neat.Train(10000, 100, 0.1, 3, 30, wait, inputs, expectedOutputs, Crossover.TwoPointCrossover, ActivationFunction.Identity); //Ann ann = neat.Train(1000, 100, 0.03, 3, 30, false, inputs, expectedOutputs, Crossover.TwoPointCrossover, ActivationFunction.Identity); //Ann ann = neat.Train(1000, 100, 0.03, 3, 30, false, inputData.NormalizedData, outputData.NormalizedData, Crossover.BestParentClone, ActivationFunction.Sigmoid); Ann ann = neat.Train(1000, 100, 0.03, 3, 30, false, inputData.NormalizedData, outputData.NormalizedData, Crossover.BestParentClone, ActivationFunction.Identity); Dispatcher.Invoke(() => { controlsToDisable.ForEach(x => x.IsEnabled = true); controlsToEnable.ForEach(x => x.IsEnabled = false); SVCanvas.Background = new SolidColorBrush(Colors.Gray); }); if (!wait) { DrawAnn(ann); } }