Exemplo n.º 1
0
        public void testRandomVariableConversionToParticleSet()
        {
            RandomVariable rv = rainman.prior();
            ParticleSet    ps = rv.toParticleSet(rainman, randomizer, 10);

            Assert.AreEqual(5, ps
                            .numberOfParticlesWithState(HmmConstants.RAINING));
            Assert.AreEqual(5, ps
                            .numberOfParticlesWithState(HmmConstants.NOT_RAINING));
        }
Exemplo n.º 2
0
        public void testRoundTripConversion()
        {
            RandomVariable rv = particleSet.toRandomVariable();
            Randomizer     r  = new MockRandomizer(new double[] { 0.1, 0.2, 0.3, 0.4,
                                                                  0.9 });
            ParticleSet ps2 = rv.toParticleSet(rainman, r, 10);

            Assert.AreEqual(8, ps2
                            .numberOfParticlesWithState(HmmConstants.RAINING));
            Assert.AreEqual(2, ps2
                            .numberOfParticlesWithState(HmmConstants.NOT_RAINING));
        }