private void numNeurons_ValueChanged(object sender, EventArgs e) { int n = (int)numNeurons.Value; if (_Layer.NumberOfNeurons != n) { _Layer.NumberOfNeurons = n; panelNeurons.Controls.Clear(); Point p = new Point(50, 0); for (int i = 0; i < _Layer.Neurons.Count; i++) { NeuronControl nc = new NeuronControl(); nc.Neuron = _Layer.Neurons[i]; nc.NeuronControlClicked = new NeuronControl.NeuronControlClickedDelegate(SetCurrentNeuron); panelNeurons.Controls.Add(nc); nc.Location = p; p.Y += 55; } } }
void SetCurrentNeuron(NeuronControl neuron_control) { if (!txtNeuronThreshold.Enabled) { txtNeuronThreshold.Enabled = true; } if (!btnRandThreshold.Enabled) { btnRandThreshold.Enabled = true; } foreach (NeuronControl nc in panelNeurons.Controls) { if (!nc.Equals(neuron_control)) { nc.Selected = false; } } neuron_control.Selected = true; SelectedNeuron = neuron_control.Neuron; txtNeuronThreshold.Value = (decimal)SelectedNeuron.Threshold; }
void SetUI() { if (_Layer != null) { prenn = _Layer.NumberOfNeurons; this.labLayerType.Text = "Layer type: " + _Layer.LayerType.ToString() + " layer"; numNeurons.Value = _Layer.NumberOfNeurons; Point p = new Point(50, 0); for (int i = 0; i < _Layer.Neurons.Count; i++) { NeuronControl nc = new NeuronControl(); nc.Neuron = _Layer.Neurons[i]; nc.NeuronControlClicked = new NeuronControl.NeuronControlClickedDelegate(SetCurrentNeuron); panelNeurons.Controls.Add(nc); nc.Location = p; p.Y += 55; } switch (_Layer.InputCombinationFunction) { case InputCombinationFunctionType.LinearProduct: radioCFLP.Checked = true; labCFHelp.Text = "The net input is the sum of the linear products of outputs of the neurons in the previous layer and weights of the pre synapses."; break; case InputCombinationFunctionType.EucledianDistance: radCFED.Checked = true; labCFHelp.Text = "The net input is the sum of eucledian distance between the synapses weights and outputs of the previous layers neuron."; break; case InputCombinationFunctionType.ManhattanDistance: radCFMD.Checked = true; labCFHelp.Text = "The net input is the sum of manhattan distance between the synapses weights and outputs of the previous layers neuron."; break; } if (_Layer.ActivationFunction != null) { switch (_Layer.ActivationFunction.FunctionName) { case "Unipolar Sign Function": USF = (UnipolarSignFunction)_Layer.ActivationFunction; radAFUSF.Checked = true; break; case "Bipolar Sign Function": BSF = (BipolarSignFunction)_Layer.ActivationFunction; radAFBSF.Checked = true; break; case "Unipolar Linear Function": ULF = (UnipolarLinearFunction)_Layer.ActivationFunction; radAFULF.Checked = true; break; case "Bipolar Linear Function": BLF = (BipolarLinearFunction)_Layer.ActivationFunction; radAFBLF.Checked = true; break; case "Sigmoidal Unipolar Function": SUF = (SigmoidalUnipolarFunction)_Layer.ActivationFunction; radAFSUF.Checked = true; break; case "Sigmoidal Bipolar Function": SBF = (SigmoidalBipolarFunction)_Layer.ActivationFunction; radAFSBF.Checked = true; break; case "Tangent Hyperbolic Function": THF = (TangentHyperbolicFunction)_Layer.ActivationFunction; radAFTHF.Checked = true; break; case "Gaussian Activation Function": GAF = (GaussianActivationFunction)_Layer.ActivationFunction; radAFGAF.Checked = true; break; } SetAFParams(); } else { radAFNone.Checked = true; } } }
void SetCurrentNeuron(NeuronControl neuron_control) { if (!txtNeuronThreshold.Enabled) txtNeuronThreshold.Enabled = true; if (!btnRandThreshold.Enabled) btnRandThreshold.Enabled = true; foreach (NeuronControl nc in panelNeurons.Controls) { if (!nc.Equals(neuron_control)) { nc.Selected = false; } } neuron_control.Selected = true; SelectedNeuron = neuron_control.Neuron; txtNeuronThreshold.Value = (decimal)SelectedNeuron.Threshold; }