class_docstr: The kalmanFilter class the provide the basic functionalities
  
  Attributes:
      discount: the discounting factor determining how much information to carry on
      updateInnovation: indicate whether the innovation matrix should be updated.
                        default to True.
  
  Methods:
      predict: predict one step ahead of the current state
      forwardFilter: one step filter on the model given a new observation
      backwardSmoother: one step backward smooth given the future model and the
                        filtered state and systematic covariance
      backwardSampler: similar to backwardSmoother, using sampling instead of
                       deterministic equations.
      updateDiscount: for updating the discount factors
class_docstr_tok: ["The","kalmanFilter","class","the","provide","the","basic","functionalities","Attributes",":","discount",":","the","discounting","factor","determining","how","much","information","to","carry","on","updateInnovation",":","indicate","whether","the","innovation","matrix","should","be","updated",".","default","to","True",".","Methods",":","predict",":","predict","one","step","ahead","of","the","current","state","forwardFilter",":","one","step","filter","on","the","model","given","a","new","observation","backwardSmoother",":","one","step","backward","smooth","given","the","future","model","and","the","filtered","state","and","systematic","covariance","backwardSampler",":","similar","to","backwardSmoother",",","using","sampling","instead","of","deterministic","equations",".","updateDiscount",":","for","updating","the","discount","factors"]
docstr: The backwardSmoother for one step backward smoothing
  
  Args:
      model: the @baseModel used for backward smoothing, the model shall store
           the following information
           model.state: the last smoothed states (t + 1)
           model.sysVar: the last smoothed system variance (t + 1)
           model.transition: the transition at time t + 1
           model.evaluation: the evaluation vector at time t
           model.prediction.sysVar: the predicted system variance for time t + 1
           model.prediction.state: the predicted state for time t + 1
           rawState: the unsmoothed state at time t
           rawSysVar: the unsmoothed system variance at time t
      rawState: the filtered state at the current time stamp
      rawSysVar: the filtered systematic covariance at the current time stamp
  
  Returns:
      The smoothed results are stored in the 'model' replacing the filtered result.
docstr_tok: ["The","backwardSmoother","for","one","step","backward","smoothing","Args",":","model",":","the","@","baseModel","used","for","backward","smoothing",",","the","model","shall","store","the","following","information","model.state",":","the","last","smoothed","states","(","t","+","1",")","model.sysVar",":","the","last","smoothed","system","variance","(","t","+","1",")","model.transition",":","the","transition","at","time","t","+","1","model.evaluation",":","the","evaluation","vector","at","time","t","model.prediction.sysVar",":","the","predicted","system","variance","for","time","t","+","1","model.prediction.state",":","the","predicted","state","for","time","t","+","1","rawState",":","the","unsmoothed","state","at","time","t","rawSysVar",":","the","unsmoothed","system","variance","at","time","t","rawState",":","the","filtered","state","at","the","current","time","stamp","rawSysVar",":","the","filtered","systematic","covariance","at","the","current","time","stamp","Returns",":","The","smoothed","results","are","stored","in","the","'model","'","replacing","the","filtered","result","."]
code: def backwardSmoother(self, model, rawState, rawSysVar):
      """The backwardSmoother for one step backward smoothing
  
      Args:
          model: the @baseModel used for backward smoothing, the model shall store
               the following information
               model.state: the last smoothed states (t + 1)
               model.sysVar: the last smoothed system variance (t + 1)
               model.transition: the transition at time t + 1
               model.evaluation: the evaluation vector at time t
               model.prediction.sysVar: the predicted system variance for time t + 1
               model.prediction.state: the predicted state for time t + 1
               rawState: the unsmoothed state at time t
               rawSysVar: the unsmoothed system variance at time t
          rawState: the filtered state at the current time stamp
          rawSysVar: the filtered systematic covariance at the current time stamp
  
      Returns:
          The smoothed results are stored in the 'model' replacing the filtered result.
      """
  
      # check whether evaluation has missing data, if so, we need to take care of it
      # if dealWithMissingEvaluation:
      #    loc = self._modifyTransitionAccordingToMissingValue(model)
  
      #### use generalized inverse to ensure the computation stability #######
  
      predSysVarInv = self._gInverse(model.prediction.sysVar)
  
      ################################################
  
      backward = np.dot(
          np.dot(rawSysVar, model.transition.T), predSysVarInv
      )
      model.state = rawState + np.dot(
          backward, (model.state - model.prediction.state)
      )
      model.sysVar = rawSysVar + np.dot(
          np.dot(backward, (model.sysVar - model.prediction.sysVar)),
          backward.T,
      )
      model.obs = np.dot(model.evaluation, model.state)
      model.obsVar = (
          np.dot(
              np.dot(model.evaluation, model.sysVar), model.evaluation.T
          )
          + model.noiseVar
      )
  
file_path: pydlm/pydlm/base/kalmanFilter.py
imports: import numpy
  import pydlm.base.tools
label_desc: Use image node_id 4 for calling the kalmanFilter obj's underlying member method code with example usage: obj.backwardSmoother(model, rawState, rawSysVar) without return types