Exemple #1
0
 private void btnRandomizeAll_Click(object sender, EventArgs e)
 {
     foreach (Synapsis s in NeuralNetwork.Synapses)
     {
         s.SetRandomWeight();
     }
     foreach (Control c in panelSynapses.Controls)
     {
         if (c.GetType() == typeof(SynapsisControl))
         {
             SynapsisControl sc = c as SynapsisControl;
             sc.UpdateWeightChange();
         }
     }
 }
Exemple #2
0
        void ShowSynapses()
        {
            try
            {
                List <Synapsis> synapses = NeuralNetwork.Synapses.ToList();
                if (comboShowFromLayer.SelectedItem.ToString() != "All layers")
                {
                    Layer l = this.NeuralNetwork.GetLayer(comboShowFromLayer.SelectedItem.ToString());
                    if (l != null)
                    {
                        synapses = synapses.FindAll(delegate(Synapsis s) { return(s.From.Layer == l); });
                    }
                    else
                    {
                        MessageBox.Show("Damn");
                    }
                }

                if (comboShowToLayer.SelectedItem.ToString() != "All layers")
                {
                    Layer l = this.NeuralNetwork.GetLayer(comboShowToLayer.SelectedItem.ToString());
                    if (l != null)
                    {
                        synapses = synapses.FindAll(delegate(Synapsis s) { return(s.To.Layer == l); });
                    }
                }

                panelSynapses.Controls.Clear();
                Point P = new Point(0, 0);
                for (int i = 0; i < synapses.Count; i++)
                {
                    SynapsisControl sc = new SynapsisControl(NeuralNetwork, synapses[i]);
                    panelSynapses.Controls.Add(sc);
                    sc.Deleted  = SynapsisDeleted;
                    sc.Location = P;
                    P.Y        += 44;
                }
            }
            catch
            {
            }
        }
        void ShowSynapses()
        {
            try
            {
                List<Synapsis> synapses = NeuralNetwork.Synapses.ToList();
                if (comboShowFromLayer.SelectedItem.ToString() != "All layers")
                {
                    Layer l = this.NeuralNetwork.GetLayer(comboShowFromLayer.SelectedItem.ToString());
                    if (l != null)
                    {
                        synapses = synapses.FindAll(delegate(Synapsis s) { return s.From.Layer == l; });
                    }
                    else MessageBox.Show("Damn");
                }

                if (comboShowToLayer.SelectedItem.ToString() != "All layers")
                {
                    Layer l = this.NeuralNetwork.GetLayer(comboShowToLayer.SelectedItem.ToString());
                    if (l != null)
                    {
                        synapses = synapses.FindAll(delegate(Synapsis s) { return s.To.Layer == l; });
                    }
                }

                panelSynapses.Controls.Clear();
                Point P = new Point(0, 0);
                for (int i = 0; i < synapses.Count; i++)
                {
                    SynapsisControl sc = new SynapsisControl(NeuralNetwork, synapses[i]);
                    panelSynapses.Controls.Add(sc);
                    sc.Deleted = SynapsisDeleted;
                    sc.Location = P;
                    P.Y += 44;
                }
            }
            catch
            {
            }
        }