예제 #1
0
        /// <summary>
        ///   Constructs a Gaussian-Bernoulli network with
        ///   visible Gaussian units and hidden Bernoulli units.
        /// </summary>
        ///
        /// <param name="inputsCount">The number of inputs for the machine.</param>
        /// <param name="hiddenNeurons">The number of hidden neurons in the machine.</param>
        ///
        /// <returns>A Gaussian-Bernoulli Restricted Boltzmann Machine</returns>
        ///
        public static RestrictedBoltzmannMachine CreateGaussianBernoulli(int inputsCount, int hiddenNeurons)
        {
            RestrictedBoltzmannMachine network = new RestrictedBoltzmannMachine(inputsCount, hiddenNeurons);

            foreach (var neuron in network.Visible.Neurons)
            {
                neuron.ActivationFunction = new GaussianFunction();
            }

            return(network);
        }
예제 #2
0
        /// <summary>
        ///   Stacks a new Boltzmann Machine at the end of this network.
        /// </summary>
        ///
        /// <param name="network">The machine to be added to the network.</param>
        ///
        public void Push(RestrictedBoltzmannMachine network)
        {
            int lastLayerNeurons;

            if (machines.Count > 0)
            {
                lastLayerNeurons = machines[machines.Count - 1].Hidden.Neurons.Length;
            }
            else
            {
                lastLayerNeurons = inputsCount;
            }

            machines.Add(network);

            // Override BestCS layers
            layers = new Layer[machines.Count];
            for (int i = 0; i < layers.Length; i++)
            {
                layers[i] = machines[i].Hidden;
            }
        }