コード例 #1
0
        private void Recall(bool reconstruct)
        {
            string[] sp = textBox1.Text.Split(',');
            if (sp.Length != 2)
            {
                label1.Text = "You need to enter <neuron>,<layer>!";
                label1.Refresh();
                return;
            }
            try
            {
                int    neuron = int.Parse(sp[0]);
                int    layer  = int.Parse(sp[1]);
                string c      = (layer == LAYERS.Length - 1) ? listBox1.Items[neuron].ToString() : "(not a category)";

                double[] a = (reconstruct) ? new double[LAYERS[layer]] : new double[NUM_CATEGORIES];
                a[neuron] = 1;

                double[] r = (reconstruct) ? _network.Reconstruct(a, layer) : _network.GenerateInput(a);
                Bitmap   bm;
                _atoi.Convert(r, out bm);

                label1.Text = "Reconstructing " + c + ", length of reconstruction: " + r.Length;
                label1.Refresh();

                pictureBox1.Image = bm;
                pictureBox1.Refresh();
            }
            catch (Exception ex)
            {
                label1.Text  = ex.Message + "\n" + ex.StackTrace + "\n";
                label1.Text += "Reconstruction input params invalid. neuron should be < size of layer.";
                label1.Refresh();
            }
        }