public FormMain() { InitializeComponent(); showDigitized = chkDigitizedView.Checked; nx = 10; ny = 10; bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height, PixelFormat.Format24bppRgb); penHand = new Pen(Color.White, 6f); penHand.StartCap = System.Drawing.Drawing2D.LineCap.Round; penHand.EndCap = System.Drawing.Drawing2D.LineCap.Round; picBackColor = Color.Black; rawSamples = new List <RawSample>(); // BindingSource bs = new BindingSource(rawSamples, ""); // bindingNavigator1.BindingSource = bs; digitized = null; charNet = new CharRecognizerNetwork(); txtA.Text = charNet.const_a.ToString(); txtBias.Text = charNet.bias.ToString(); txtEta.Text = charNet.const_Eta.ToString(); numGridN.Value = nx; }
public CharRecognSpecies(CookedSamples cooked, int netInputs, params int[] neuronCounts) { charNetwork = new CharRecognizerNetwork(); charNetwork.AllocateNetwork(false, netInputs, neuronCounts); charNetwork.SetWeights(WeightsFromChromosomes(), ); charNetwork = net; samples = cooked; samplesToPass = cooked.Length; }
protected override double CalcFinalFunc() { double[] smpOutput, smpInput; double netError = 0; for (int i = 0; i < samplesToPass; i++) { samples.GetRandomSample(out smpInput, out smpOutput); double[] netOutput = charNetwork.FeedForward(smpInput); netError += CharRecognizerNetwork.CalculateError(smpOutput, netOutput); } // TODO try 1/netError return -netError; }