Exemple #1
0
    /// <summary>
    /// Main function for computing Neural Network result.
    /// </summary>
    /// <param name="p">Phase value.</param>
    public void Compute(float p)
    {
        int pIndex0;

        X = (X - Xmean) / Xstd;

        switch (WeightsMode)
        {
        case Mode.constant:
            pIndex0 = (int)((p / (2 * PI)) * 50);

            // Layer 1
            H0 = (W0[pIndex0] * X) + B0[pIndex0];
            H0.ELU();

            // Layer 2
            H1 = (W1[pIndex0] * H0) + B1[pIndex0];
            H1.ELU();

            // Layer 3, network output
            Y = (W2[pIndex0] * H1) + B2[pIndex0];
            break;

        case Mode.linear:
            break;

        case Mode.cubic:
            break;
        }

        Y = (Y * Ystd) + Ymean;
    }