Пример #1
0
        private void Signals(float[] output)
        {
            float[] dif = new float[OutputNodes];
            for (int i = 0; i < OutputNodes; i++)
            {
                dif[i] = Output[i] - output[i];
            }

            for (int j = 0; j < OutputNodes; j++)
            {
                mSignals[Length - 1][j] = Mathn.DifSoftmax(Output[j]) * dif[j];
            }

            for (int l = Length - 2; l >= 0; l--)
            {
                for (int j = 0; j < Nodes[l]; j++)
                {
                    float sum = 0;

                    for (int k = 0; k < Nodes[l + 1]; k++)
                    {
                        sum += Weigths[l + 1][k][j] * mSignals[l + 1][k];
                    }

                    mSignals[l][j] = Mathn.DifSigmoid(mValues[l][j]) * sum; //Check Value
                }
            }
        }
Пример #2
0
        public float[] FeedForward(float[] input)
        {
            Input = input;

            for (int l = 0; l < Length; l++)
            {
                for (int j = 0; j < Nodes[l]; j++)
                {
                    mValues[l][j] = 0;

                    if (l == 0)
                    {
                        for (int i = 0; i < InputNodes; i++)
                        {
                            mValues[l][j] += Input[i] * Weigths[l][j][i];
                        }
                    }
                    else
                    {
                        for (int i = 0; i < Nodes[l - 1]; i++)
                        {
                            mValues[l][j] += mValues[l - 1][i] * Weigths[l][j][i];
                        }
                    }

                    if (l < Length - 1)
                    {
                        mValues[l][j] = Mathn.Sigmoid(mValues[l][j]);
                    }
                }
            }

            mValues[Length - 1] = Mathn.Softmax(mValues[Length - 1]);
            Output = mValues[Length - 1];

            return(Output);
        }