Exemple #1
0
    public void ForwardProp()
    {
        List <float> input = new List <float>();

        input.Add(0.2f);
        input.Add(4f);


        /*
         * Expected:
         *
         * Node 1: 0.2
         * Node 2: 4
         *
         * Node 4 = activation (0.2 * 0.2 + 0.4 * 4)
         * Node 4 = activation (1.64)
         *
         */
        float node4 = (float)Genome.Activation(input[0] * 0.2f + input[1] * 0.4f);

        /*
         * Node 3 = activation (node 4 - 0.3 * 0.2)
         * Node 3 = activation (node 4 - 0.06)
         */

        float node3 = (float)Genome.Activation(node4 + input[0] * -0.3f);

        Debug.Log(genome.ForwardPropagate(input)[0]);
        Debug.Log("Expected: " + node3);
        Debug.Assert(node3 == genome.ForwardPropagate(input)[0]);
    }