コード例 #1
0
        public void PushPopTest()
        {
            DeepBeliefNetwork network = new DeepBeliefNetwork(6, 2, 9);

            Assert.AreEqual(2, network.Machines.Count);
            Assert.AreEqual(6, network.InputsCount);
            Assert.AreEqual(9, network.OutputCount);
            Assert.AreEqual(2, network.Machines[0].Hidden.Neurons.Length);
            Assert.AreEqual(9, network.Machines[1].Hidden.Neurons.Length);
            Assert.AreEqual(6, network.Machines[0].Visible.Neurons.Length);
            Assert.AreEqual(2, network.Machines[1].Visible.Neurons.Length);

            network.Pop();

            Assert.AreEqual(1, network.Machines.Count);
            Assert.AreEqual(6, network.InputsCount);
            Assert.AreEqual(2, network.OutputCount);
            Assert.AreEqual(2, network.Machines[0].Hidden.Neurons.Length);
            Assert.AreEqual(6, network.Machines[0].Visible.Neurons.Length);

            network.Push(4);
            network.Push(10);

            Assert.AreEqual(3, network.Machines.Count);
            Assert.AreEqual(6, network.InputsCount);
            Assert.AreEqual(10, network.OutputCount);
            Assert.AreEqual(2, network.Machines[0].Hidden.Neurons.Length);
            Assert.AreEqual(4, network.Machines[1].Hidden.Neurons.Length);
            Assert.AreEqual(10, network.Machines[2].Hidden.Neurons.Length);

            Assert.AreEqual(6, network.Machines[0].Visible.Neurons.Length);
            Assert.AreEqual(2, network.Machines[1].Visible.Neurons.Length);
            Assert.AreEqual(4, network.Machines[2].Visible.Neurons.Length);

            network.Pop();

            Assert.AreEqual(2, network.Machines.Count);
            Assert.AreEqual(6, network.InputsCount);
            Assert.AreEqual(4, network.OutputCount);
            Assert.AreEqual(2, network.Machines[0].Hidden.Neurons.Length);
            Assert.AreEqual(4, network.Machines[1].Hidden.Neurons.Length);

            Assert.AreEqual(6, network.Machines[0].Visible.Neurons.Length);
            Assert.AreEqual(2, network.Machines[1].Visible.Neurons.Length);
        }