コード例 #1
0
 private void computeOutput(MHiddenLayerHeader header, MNeuronStack neuronStack)
 {
     foreach (MNeuron x in neuronStack.Stack)
     {
         x.Output = ActivationFunctions.computeOutput(header, x);
         Console.WriteLine("test_output " + x.Output);
         x.OutputTextBox.Text = x.Output.ToString();
     }
 }
コード例 #2
0
        private void computeGlobalInput(MHiddenLayerHeader header, MNeuronStack neuronStack)
        {
            var inputFunction = header.InputFunction;

            foreach (MNeuron x in neuronStack.Stack)
            {
                x.GlobalInput = InputFunctions.computeGlobalInput(inputFunction, x);
                Console.WriteLine("test_input " + x.GlobalInput);
                Console.WriteLine(inputFunction);
            }
        }
コード例 #3
0
        private GroupBox generateHiddenLayerHeader(String text, MHiddenLayerHeader hiddenLayerHeader, String tag)
        {
            // groupbox
            var gb = new GroupBox();

            gb.Text   = text;
            gb.Anchor = AnchorStyles.Top | AnchorStyles.Left;
            gb.Dock   = DockStyle.Fill;

            var num = hiddenLayerHeader.Numeric;

            num.Left = (gb.Width - num.Width) / 2;
            num.Top  = (gb.Height - num.Height) / 2;
            num.Tag  = tag;

            gb.Controls.Add(num);
            gb.Controls.Add(hiddenLayerHeader.Button);

            return(gb);
        }
コード例 #4
0
        static public decimal computeOutput(MHiddenLayerHeader header, MNeuron neuron)
        {
            var     function = header.ActivationFunction;
            var     gi       = neuron.GlobalInput;
            decimal t        = 0;

            if (function.Equals("Treapta"))
            {
                t = treapta(gi, header.Theta);
                return(t);
                //t = Decimal.Parse(activationTextBox.Text);
            }
            if (function.Equals("Sigmoidala"))
            {
                if (header.IsBinary)
                {
                    decimal o = sigmoidala(gi, header.G, header.Theta);
                    //decimal o = Decimal.Parse(activationTextBox.Text);

                    if (o < 0.5m)
                    {
                        t = 0;
                    }
                    else
                    {
                        t = 1;
                    }

                    return(t);
                }
                else
                {
                    t = sigmoidala(gi, header.G, header.Theta);
                    return(t);
                }
            }
            if (function.Equals("Signum"))
            {
                t = signum(gi, header.G, header.Theta);
                //t = Decimal.Parse(activationTextBox.Text);
                return(t);
            }
            if (function.Equals("TanH"))
            {
                if (header.IsBinary)
                {
                    decimal o = tanH(gi, header.G, header.Theta);
                    //decimal o = Decimal.Parse(activationTextBox.Text);

                    if (o < 0)
                    {
                        t = -1;
                    }
                    else
                    {
                        t = 1;
                    }

                    return(t);
                }
                else
                {
                    t = tanH(gi, header.G, header.Theta);
                    return(t);
                }
            }
            if (function.Equals("Rampa"))
            {
                if (header.IsBinary)
                {
                    decimal o = rampa(gi, header.A, header.Theta);
                    //decimal o = Decimal.Parse(activationTextBox.Text);

                    if (o < 0)
                    {
                        t = -1;
                    }
                    else
                    {
                        t = 1;
                    }

                    return(t);
                }
                else
                {
                    t = rampa(gi, header.A, header.Theta);
                }
            }

            //outputTextBox.Text = t.ToString();
            return(-1);
        }