Esempio n. 1
0
        /* Constructor: NeuralNet

            Creates a standard backpropagation neural network, which is sparsely connected, this will default the <NetworkType> to <NetworkType::LAYER>

            Parameters:
                connectionRate - The connection rate controls how many connections there will be in the
                    network. If the connection rate is set to 1, the network will be fully
                    connected, but if it is set to 0.5 only half of the connections will be set.
                    A connection rate of 1 will yield the same result as <fann_create_standard at http://libfann.github.io/fann/docs/files/fann-h.html#fann_create_standard>
                numLayers - The total number of layers including the input and the output layer.
                layers - Integer values determining the number of neurons in each layer starting with the
                    input layer and ending with the output layer.

            This function appears in FANN >= 2.3.0.
        */
        public NeuralNet(float connectionRate, ICollection<uint> layers)
        {
            using (uintArray newLayers = new uintArray(layers.Count))
            {
                int i = 0;
                foreach (uint count in layers)
                {
                    newLayers.setitem(i, count);
                    i++;
                }
                Outputs = newLayers.getitem(layers.Count - 1);
                net = new neural_net(connectionRate, (uint)layers.Count, newLayers.cast());
            }
        }
Esempio n. 2
0
        /* Constructor: NeuralNet

            Creates a standard backpropagation neural network, which is sparsely connected, this will default the <NetworkType> to <NetworkType::LAYER>

            Parameters:
                connectionRate - The connection rate controls how many connections there will be in the
                    network. If the connection rate is set to 1, the network will be fully
                    connected, but if it is set to 0.5 only half of the connections will be set.
                    A connection rate of 1 will yield the same result as <fann_create_standard at http://libfann.github.io/fann/docs/files/fann-h.html#fann_create_standard>
                numLayers - The total number of layers including the input and the output layer.
                ... - Integer values determining the number of neurons in each layer starting with the
                    input layer and ending with the output layer.

            This function appears in FANN >= 2.3.0.
        */
        public NeuralNet(float connectionRate, uint numLayers, params uint[] args)
        {
            using (uintArray newLayers = new uintArray((int)numLayers))
            {
                for (int i = 0; i < args.Length; i++)
                {
                    newLayers.setitem(i, args[i]);
                }
                Outputs = args[args.Length - 1];
                net = new neural_net(connectionRate, numLayers, newLayers.cast());
            }
        }