Example #1
0
        /// <summary>
        ///     Construct a deep belief neural network.
        /// </summary>
        /// <param name="inputCount">The input count.</param>
        /// <param name="hidden">The counts for the hidden layers.</param>
        /// <param name="outputCount">The output neuron count.</param>
        public DeepBeliefNetwork(int inputCount, int[] hidden, int outputCount)
        {
            int inputSize;

            _layers = new HiddenLayer[hidden.Length];
            _rbm    = new RestrictedBoltzmannMachine[hidden.Length];

            for (var i = 0; i < _rbm.Length; i++)
            {
                if (i == 0)
                {
                    inputSize = inputCount;
                }
                else
                {
                    inputSize = hidden[i - 1];
                }

                _layers[i] = new HiddenLayer(this, inputSize, hidden[i]);

                _rbm[i] = new RestrictedBoltzmannMachine(_layers[i]);
            }

            _outputLayer = new DeepLayer(this, hidden[_layers.Length - 1], outputCount);
            Random       = new MersenneTwisterGenerateRandom();
        }
Example #2
0
        /// <summary>
        /// Construct a deep belief neural network. 
        /// </summary>
        /// <param name="inputCount">The input count.</param>
        /// <param name="hidden">The counts for the hidden layers.</param>
        /// <param name="outputCount">The output neuron count.</param>
        public DeepBeliefNetwork(int inputCount, int[] hidden, int outputCount)
        {
            int inputSize;

            _layers = new HiddenLayer[hidden.Length];
            _rbm = new RestrictedBoltzmannMachine[hidden.Length];

            for (int i = 0; i < _rbm.Length; i++)
            {
                if (i == 0)
                {
                    inputSize = inputCount;
                }
                else
                {
                    inputSize = hidden[i - 1];
                }

                _layers[i] = new HiddenLayer(this, inputSize, hidden[i]);

                _rbm[i] = new RestrictedBoltzmannMachine(_layers[i]);
            }

            _outputLayer = new DeepLayer(this, hidden[_layers.Length - 1], outputCount);
            Random = new MersenneTwisterGenerateRandom();
        }