Esempio n. 1
0
        public override void Predict()
        {
            //Normalise Input
            Normalise(X, Xmean, Xstd, Y);

            //Process Gating Network 1
            for (int i = 0; i < ControlNeurons.Length; i++)
            {
                BX.SetValue(i, 0, Y.GetValue(ControlNeurons[i], 0));
            }
            ELU(Layer(BX, BW0_1, Bb0_1, BY));
            ELU(Layer(BY, BW1_1, Bb1_1, BY));
            SoftMax(Layer(BY, BW2_1, Bb2_1, BY));
            W0.SetZero(); b0.SetZero();
            for (int i = 0; i < YDimBlend; i++)
            {
                float weight = BY.GetValue(i, 0);
                Blend(W0, CW[6 * i + 0], weight);
                Blend(b0, CW[6 * i + 1], weight);
            }

            //Process Gating Network 2
            for (int i = 0; i < ControlNeurons.Length; i++)
            {
                BX.SetValue(i, 0, Y.GetValue(ControlNeurons[i], 0));
            }
            ELU(Layer(BX, BW0_2, Bb0_2, BY));
            ELU(Layer(BY, BW1_2, Bb1_2, BY));
            SoftMax(Layer(BY, BW2_2, Bb2_2, BY));
            W1.SetZero(); b1.SetZero();
            for (int i = 0; i < YDimBlend; i++)
            {
                float weight = BY.GetValue(i, 0);
                Blend(W1, CW[6 * i + 2], weight);
                Blend(b1, CW[6 * i + 3], weight);
            }

            //Process Gating Network 3
            for (int i = 0; i < ControlNeurons.Length; i++)
            {
                BX.SetValue(i, 0, Y.GetValue(ControlNeurons[i], 0));
            }
            ELU(Layer(BX, BW0_3, Bb0_3, BY));
            ELU(Layer(BY, BW1_3, Bb1_3, BY));
            SoftMax(Layer(BY, BW2_3, Bb2_3, BY));
            W2.SetZero(); b2.SetZero();
            for (int i = 0; i < YDimBlend; i++)
            {
                float weight = BY.GetValue(i, 0);
                Blend(W2, CW[6 * i + 4], weight);
                Blend(b2, CW[6 * i + 5], weight);
            }

            //Process Motion-Prediction Network
            ELU(Layer(Y, W0, b0, Y));
            ELU(Layer(Y, W1, b1, Y));
            Layer(Y, W2, b2, Y);

            //Renormalise Output
            Renormalise(Y, Ymean, Ystd, Y);
        }