public void testFixedLagSmoothing_lag_2_UmbrellaWorld() { FixedLagSmoothing uw = new FixedLagSmoothing(HMMExampleFactory.getUmbrellaWorldModel(), 2); // Day 1 - Lag 2 ICollection <AssignmentProposition> e1 = CollectionFactory.CreateQueue <AssignmentProposition>(); e1.Add(new AssignmentProposition(ExampleRV.UMBREALLA_t_RV, true)); ICategoricalDistribution smoothed = uw.fixedLagSmoothing(e1); Assert.IsNull(smoothed); // Day 2 - Lag 2 ICollection <AssignmentProposition> e2 = CollectionFactory.CreateQueue <AssignmentProposition>(); e2.Add(new AssignmentProposition(ExampleRV.UMBREALLA_t_RV, true)); smoothed = uw.fixedLagSmoothing(e2); Assert.IsNull(smoothed); // Day 3 - Lag 2 ICollection <AssignmentProposition> e3 = CollectionFactory.CreateQueue <AssignmentProposition>(); e3.Add(new AssignmentProposition(ExampleRV.UMBREALLA_t_RV, false)); smoothed = uw.fixedLagSmoothing(e3); Assert.IsNotNull(smoothed); assertArrayEquals(new double[] { 0.861, 0.138 }, smoothed.getValues(), DELTA_THRESHOLD); }
public void setUp() { uw = new HMMForwardBackward(HMMExampleFactory.getUmbrellaWorldModel()); }
static void fixedLagSmoothingDemo() { System.Console.WriteLine("DEMO: Fixed-Lag-Smoothing"); System.Console.WriteLine("========================="); System.Console.WriteLine("Lag = 1"); System.Console.WriteLine("-------"); FixedLagSmoothing uw = new FixedLagSmoothing(HMMExampleFactory.getUmbrellaWorldModel(), 1); // Day 1 - Lag 1 ICollection <AssignmentProposition> e1 = CollectionFactory.CreateQueue <AssignmentProposition>(); e1.Add(new AssignmentProposition(ExampleRV.UMBREALLA_t_RV, true)); ICategoricalDistribution smoothed = uw.fixedLagSmoothing(e1); System.Console.WriteLine("Day 1 (Umbrella_t=true) smoothed:\nday 1=" + smoothed); // Day 2 - Lag 1 ICollection <AssignmentProposition> e2 = CollectionFactory.CreateQueue <AssignmentProposition>(); e2.Add(new AssignmentProposition(ExampleRV.UMBREALLA_t_RV, true)); smoothed = uw.fixedLagSmoothing(e2); System.Console.WriteLine("Day 2 (Umbrella_t=true) smoothed:\nday 1=" + smoothed); // Day 3 - Lag 1 ICollection <AssignmentProposition> e3 = CollectionFactory.CreateQueue <AssignmentProposition>(); e3.Add(new AssignmentProposition(ExampleRV.UMBREALLA_t_RV, false)); smoothed = uw.fixedLagSmoothing(e3); System.Console.WriteLine("Day 3 (Umbrella_t=false) smoothed:\nday 2=" + smoothed); System.Console.WriteLine("-------"); System.Console.WriteLine("Lag = 2"); System.Console.WriteLine("-------"); uw = new FixedLagSmoothing(HMMExampleFactory.getUmbrellaWorldModel(), 2); // Day 1 - Lag 2 e1 = CollectionFactory.CreateQueue <AssignmentProposition>(); e1.Add(new AssignmentProposition(ExampleRV.UMBREALLA_t_RV, true)); smoothed = uw.fixedLagSmoothing(e1); System.Console.WriteLine("Day 1 (Umbrella_t=true) smoothed:\nday 1=" + smoothed); // Day 2 - Lag 2 e2 = CollectionFactory.CreateQueue <AssignmentProposition>(); e2.Add(new AssignmentProposition(ExampleRV.UMBREALLA_t_RV, true)); smoothed = uw.fixedLagSmoothing(e2); System.Console.WriteLine("Day 2 (Umbrella_t=true) smoothed:\nday 1=" + smoothed); // Day 3 - Lag 2 e3 = CollectionFactory.CreateQueue <AssignmentProposition>(); e3.Add(new AssignmentProposition(ExampleRV.UMBREALLA_t_RV, false)); smoothed = uw.fixedLagSmoothing(e3); System.Console.WriteLine("Day 3 (Umbrella_t=false) smoothed:\nday 1=" + smoothed); System.Console.WriteLine("========================="); }