code: def testForwardFilter(self):
      dlm = builder()
      dlm.add(self.trend0)
      dlm.initialize()
      self.kf1.predict(dlm.model)
      self.assertAlmostEqual(dlm.model.prediction.obs, 0)
  
      # the prior on the mean is zero, but observe 1, with
      # discount = 1, one should expect the filterd mean to be 0.5
      self.kf1.forwardFilter(dlm.model, 1)
      self.assertAlmostEqual(dlm.model.obs, 0.5)
      self.assertAlmostEqual(dlm.model.prediction.obs, 0)
      self.assertAlmostEqual(dlm.model.sysVar, 0.375)
  
      self.kf1.predict(dlm.model)
      self.assertAlmostEqual(dlm.model.obs, 0.5)
      self.assertAlmostEqual(dlm.model.prediction.obs, 0.5)
  
      dlm.initialize()
      self.kf0.predict(dlm.model)
      self.assertAlmostEqual(dlm.model.prediction.obs, 0)
  
      # the prior on the mean is zero, but observe 1, with discount = 0
      # one should expect the filtered mean close to 1
      self.kf0.forwardFilter(dlm.model, 1)
      self.assertAlmostEqual(dlm.model.obs[0, 0], 1)
      self.assertAlmostEqual(dlm.model.prediction.obs[0, 0], 0)
      self.assertAlmostEqual(dlm.model.sysVar[0, 0], 0.5)
  
      self.kf0.predict(dlm.model)
      self.assertAlmostEqual(dlm.model.obs[0, 0], 1)
      self.assertAlmostEqual(dlm.model.prediction.obs[0, 0], 1)
  
file_path: pydlm/tests/base/testKalmanFilter.py
imports: import numpy
  import unittest
  from pydlm.modeler.trends import trend
  from pydlm.modeler.seasonality import seasonality
  from pydlm.modeler.builder import builder
  from pydlm.base.kalmanFilter import kalmanFilter
label_desc: Use image node_id 2 for calling the testKalmanFilter obj's underlying member method code with example usage: obj.testForwardFilter() without return types