Ejemplo n.º 1
0
        //Forward Propagate this Neuron
        public void ForwardPropag(vNeuron[,] nn)
        {
            if (this.layer != 0)
            {
                this.GetInputs(nn);
            }

            this.output          = Enumerable.Repeat(0d, this.inputs[0].Count).ToList();
            this.postActOutput   = Enumerable.Repeat(0d, this.inputs[0].Count).ToList();
            this.handedDownDelta = main.createNewMatrix(inputs[0].Count, inputs[0].Count);

            for (int i = 0; i < this.inputs.Count; i++)
            {
                List <double>         curInput = this.inputs[i];
                List <List <double> > result   = MyMath.matMulti(this.weights[i], MyMath.makeVertiColMat(curInput));
                this.output = MyMath.transposeMat(MyMath.matAdd(MyMath.makeVertiColMat(this.output), result))[0];
            }

            if (this.actFunc == actFuncType.logistic)
            {
                for (int j = 0; j < this.output.Count; j++)
                {
                    this.postActOutput[j] = MyMath.logisticFunc(this.output[j], beta[j]);
                }
            }
            else if (this.actFunc == actFuncType.identity)
            {
                for (int j = 0; j < this.output.Count; j++)
                {
                    this.postActOutput[j] = MyMath.identityFunc(this.output[j], beta[j]);
                }
            }
        }
Ejemplo n.º 2
0
        //Forward Propagate this Neuron
        public string ForwardPropag(Neuron[,] nn)
        {
            this.GetInputs(nn);

            this.output = MyMath.colMatMulti(this.inputs, this.weights);

            if (this.actFunc == actFuncType.identity)
            {
                this.postActOutput = MyMath.identityFunc(this.output, this.beta);
            }
            else if (this.actFunc == actFuncType.logistic)
            {
                this.postActOutput = MyMath.logisticFunc(this.output, this.beta);
            }
            else if (this.actFunc == actFuncType.ReLU)
            {
                this.postActOutput = MyMath.reluFunc(this.output, this.beta);
            }
            else if (this.actFunc == actFuncType.tanh)
            {
                this.postActOutput = MyMath.tanhFunc(this.output, this.beta);
            }

            return(null);
        }
Ejemplo n.º 3
0
        //Forward Propagate this Neuron
        public void ForwardPropag(mNeuron[,] nn)
        {
            if (this.layer != 0)
            {
                this.GetInputs(nn);
            }

            this.output          = main.createNewMatrix(this.inputs[0].Count, this.inputs[0][0].Count);
            this.postActOutput   = main.createNewMatrix(this.inputs[0].Count, this.inputs[0][0].Count);
            this.handedDownDelta = main.createNewMatrix(this.inputs[0].Count, this.inputs[0][0].Count);

            for (int i = 0; i < this.inputs.Count; i++)
            {
                List <List <double> > curInput = this.inputs[i];
                List <List <double> > result   = MyMath.matMulti(this.weights[i], curInput);
                this.output = MyMath.matAdd(this.output, result);
            }

            if (this.actFunc == actFuncType.logistic)
            {
                for (int m = 0; m < output.Count; m++)
                {
                    for (int n = 0; n < output[0].Count; n++)
                    {
                        this.postActOutput[m][n] = MyMath.logisticFunc(this.output[m][n], this.beta[m][n]);
                    }
                }
            }
            else if (this.actFunc == actFuncType.identity)
            {
                for (int m = 0; m < output.Count; m++)
                {
                    for (int n = 0; n < output[0].Count; n++)
                    {
                        this.postActOutput[m][n] = MyMath.identityFunc(this.output[m][n], this.beta[m][n]);
                    }
                }
            }
        }