Example #1
0
 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;
 }
Example #2
0
        private void tbnTrainBackProp_Click(object sender, EventArgs e)
        {
            if (backgroundWorkerTrain.IsBusy)
            {
                tbnTrainBackProp.Text = "Cancelling...";
                backgroundWorkerTrain.CancelAsync();
                return;
            }

            double.TryParse(txtA.Text, out charNet.const_a);
            txtA.Text = charNet.const_a.ToString();

            double.TryParse(txtBias.Text, out charNet.bias);
            txtBias.Text = charNet.bias.ToString();

            double.TryParse(txtEta.Text, out charNet.const_Eta);
            txtEta.Text = charNet.const_Eta.ToString();

            progressBar1.Maximum = charNet.MaxEpoch;
            progressBar1.Value   = 0;

            int inputs  = nx * ny;
            int outputs = chars.Length;

            int[] NeuronCounts = { inputs, (inputs + outputs) / 2, outputs };


            charNet.AllocateNetwork(inputs, NeuronCounts); // inputs may not match the number of neurons in the 1st layer

            charNet.FillSmallRandom(5e-2);

            CookSamples(out xCookedSamples, out yCookedSamples);

            // Train();
            tbnTrainBackProp.Text = "Cancel";
            backgroundWorkerTrain.RunWorkerAsync();
        }