예제 #1
0
        //Sizes: The size of A: input, <hidden networks>, output

        public Network(int[] sizes, Neural_func function, int batchsize = 1)
        {
            Layers = new Layer[sizes.Length - 1];

            for (int i = 0; i < Layers.Length; i++)    //Generates all the layers. (Minus one for the output).
            {
                Layers[i] = new Layer(sizes[i], sizes[i + 1], function, batchsize);
            }
        }
예제 #2
0
        //Matrix last_value.


        public Layer(int in_size, int out_size, Neural_func function, int batchsize = 1)
        {
            func           = function;
            this.batchsize = batchsize;                              //By default 1.
            nodes          = new Matrix(batchsize, out_size, false); //No need to randomize the node-values (For standard NN)
            #if ADD_BIAS
            weights = new Matrix(in_size + 1, out_size, true);
            #else
            weights = new Matrix(in_size, out_size, true); //Random weights!
            #endif
            //Need to randomize weights.
        }