class_docstr: Kalman Filter is used for denoising or inferring the hidden state of given data.
  
  The Kalman Filter is an unsupervised algorithm, consisting of
  several mathematical equations which are used to create
  an estimate of the state of a process.
  
  This class is the adapter for the `FilterPy` package into `sktime`.
  `KalmanFilterTransformerFP` implements hidden inferred states and
  denoising, depending on the boolean input parameter `denoising`.
  In addition, `KalmanFilterTransformerFP` provides parameter
  optimization via Expectation-Maximization (EM) algorithm.
  
  Parameters
  ----------
  state_dim : int
      System state feature dimension.
  state_transition : np.ndarray, optional (default=None)
      of shape (state_dim, state_dim) or (time_steps, state_dim, state_dim).
      State transition matrix, also referred to as `F`, is a matrix
      which describes the way the underlying series moves
      through successive time periods.
  process_noise : np.ndarray, optional (default=None)
      of shape (state_dim, state_dim) or (time_steps, state_dim, state_dim).
      Process noise matrix, also referred to as `Q`,
      the uncertainty of the dynamic model.
  measurement_noise : np.ndarray, optional (default=None)
      of shape (measurement_dim, measurement_dim) or
      (time_steps, measurement_dim, measurement_dim).
      Measurement noise matrix, also referred to as `R`,
      represents the uncertainty of the measurements.
  measurement_function : np.ndarray, optional (default=None)
      of shape (measurement_dim, state_dim) or
      (time_steps, measurement_dim, state_dim).
      Measurement equation matrix, also referred to as `H`, adjusts
      dimensions of measurements to match dimensions of state.
  initial_state : np.ndarray, optional (default=None)
      of shape (state_dim,).
      Initial estimated system state, also referred to as `X0`.
  initial_state_covariance : np.ndarray, optional (default=None)
      of shape (state_dim, state_dim).
      Initial estimated system state covariance, also referred to as `P0`.
  control_transition : np.ndarray, optional (default=None)
      of shape (state_dim, control_variable_dim) or
      (time_steps, state_dim, control_variable_dim).
      Control transition matrix, also referred to as `G`.
      `control_variable_dim` is the dimension of `control variable`,
      also referred to as `u`.
      `control variable` is an optional parameter for `fit` and `transform` functions.
  denoising : bool, optional (default=False).
      This parameter affects `transform`. If False, then `transform` will be inferring
      hidden state. If True, uses `FilterPy` `rts_smoother` for denoising.
  estimate_matrices : str or list of str, optional (default=None).
      Subset of [`state_transition`, `measurement_function`,
      `process_noise`, `measurement_noise`, `initial_state`,
      `initial_state_covariance`]
      or - `all`. If `estimate_matrices` is an iterable of strings,
      only matrices in `estimate_matrices` will be estimated using EM algorithm.
      If `estimate_matrices` is `all`,
      then all matrices will be estimated using EM algorithm.
  
      Note -
          - parameters estimated by EM algorithm assumed to be constant.
          - `control_transition` matrix cannot be estimated.
  
  See Also
  --------
  KalmanFilterTransformerPK :
      Kalman Filter transformer, adapter for the `pykalman-bardo` package
      into `sktime`.
  
  Notes
  -----
  `FilterPy` KalmanFilter documentation :
      https://filterpy.readthedocs.io/en/latest/kalman/KalmanFilter.html
  
  References
  ----------
  .. [1] Greg Welch and Gary Bishop, "An Introduction to the Kalman Filter", 2006
         https://www.cs.unc.edu/~welch/media/pdf/kalman_intro.pdf
  .. [2] R.H.Shumway and D.S.Stoffer "An Approach to time
         Series Smoothing and Forecasting Using the EM Algorithm", 1982
         https://www.stat.pitt.edu/stoffer/dss_files/em.pdf
  
  Examples
  --------
      Basic example:
  
  >>> import numpy as np  # doctest: +SKIP
  >>> import sktime.transformations.series.kalman_filter as kf
  >>> time_steps, state_dim, measurement_dim = 10, 2, 3
  >>>
  >>> X = np.random.rand(time_steps, measurement_dim) * 10
  >>> transformer = kf.KalmanFilterTransformerFP(state_dim=state_dim) # doctest: +SKIP
  >>> Xt = transformer.fit_transform(X=X)  # doctest: +SKIP
  
      Example of - denoising, matrix estimation, missing values and transform with y:
  >>> import numpy as np  # doctest: +SKIP
  >>> import sktime.transformations.series.kalman_filter as kf
  >>> time_steps, state_dim, measurement_dim = 10, 3, 3
  >>> control_variable_dim = 2
  >>>
  >>> X = np.random.rand(time_steps, measurement_dim)
  >>> # missing value
  >>> X[0][0] = np.nan
  >>>
  >>> # y
  >>> control_variable = np.random.rand(time_steps, control_variable_dim)
  >>>
  >>> # If matrices estimation is required, elements of `estimate_matrices`
  >>> # are assumed to be constants.
  >>> transformer = kf.KalmanFilterTransformerFP(  # doctest: +SKIP
  ...     state_dim=state_dim,
  ...     measurement_noise=np.eye(measurement_dim),
  ...     denoising=True,
  ...     estimate_matrices='measurement_noise'
  ...     )
  >>> Xt = transformer.fit_transform(X=X, y=control_variable)  # doctest: +SKIP
  
      Example of - dynamic inputs (matrix per time-step), missing values:
  
  >>> import numpy as np  # doctest: +SKIP
  >>> import sktime.transformations.series.kalman_filter as kf
  >>> time_steps, state_dim, measurement_dim = 10, 4, 4
  >>> control_variable_dim = 4
  >>>
  >>> X = np.random.rand(time_steps, measurement_dim)
  >>> # missing values
  >>> X[0] = [np.NaN for i in range(measurement_dim)]
  >>>
  >>> # y
  >>> control_variable = np.random.rand(control_variable_dim)
  >>>
  >>> # Dynamic input -
  >>> # `state_transition` provide different matrix for each time step.
  >>> transformer = kf.KalmanFilterTransformerFP(  # doctest: +SKIP
  ...     state_dim=state_dim,
  ...     state_transition=np.random.rand(time_steps, state_dim, state_dim),
  ...     estimate_matrices=['initial_state', 'initial_state_covariance']
  ...     )
  >>> Xt = transformer.fit_transform(X=X, y=control_variable)  # doctest: +SKIP
class_docstr_tok: ["Kalman","Filter","is","used","for","denoising","or","inferring","the","hidden","state","of","given","data",".","The","Kalman","Filter","is","an","unsupervised","algorithm",",","consisting","of","several","mathematical","equations","which","are","used","to","create","an","estimate","of","the","state","of","a","process",".","This","class","is","the","adapter","for","the","`","FilterPy","`","package","into","`","sktime","`",".","`","KalmanFilterTransformerFP","`","implements","hidden","inferred","states","and","denoising",",","depending","on","the","boolean","input","parameter","`","denoising","`",".","In","addition",",","`","KalmanFilterTransformerFP","`","provides","parameter","optimization","via","Expectation-Maximization","(","EM",")","algorithm",".","Parameters","--","--","--","--","--","state_dim",":","int","System","state","feature","dimension",".","state_transition",":","np.ndarray",",","optional","(","default=None",")","of","shape","(","state_dim",",","state_dim",")","or","(","time_steps",",","state_dim",",","state_dim",")",".","State","transition","matrix",",","also","referred","to","as","`","F","`",",","is","a","matrix","which","describes","the","way","the","underlying","series","moves","through","successive","time","periods",".","process_noise",":","np.ndarray",",","optional","(","default=None",")","of","shape","(","state_dim",",","state_dim",")","or","(","time_steps",",","state_dim",",","state_dim",")",".","Process","noise","matrix",",","also","referred","to","as","`","Q","`",",","the","uncertainty","of","the","dynamic","model",".","measurement_noise",":","np.ndarray",",","optional","(","default=None",")","of","shape","(","measurement_dim",",","measurement_dim",")","or","(","time_steps",",","measurement_dim",",","measurement_dim",")",".","Measurement","noise","matrix",",","also","referred","to","as","`","R","`",",","represents","the","uncertainty","of","the","measurements",".","measurement_function",":","np.ndarray",",","optional","(","default=None",")","of","shape","(","measurement_dim",",","state_dim",")","or","(","time_steps",",","measurement_dim",",","state_dim",")",".","Measurement","equation","matrix",",","also","referred","to","as","`","H","`",",","adjusts","dimensions","of","measurements","to","match","dimensions","of","state",".","initial_state",":","np.ndarray",",","optional","(","default=None",")","of","shape","(","state_dim",",",")",".","Initial","estimated","system","state",",","also","referred","to","as","`","X0","`",".","initial_state_covariance",":","np.ndarray",",","optional","(","default=None",")","of","shape","(","state_dim",",","state_dim",")",".","Initial","estimated","system","state","covariance",",","also","referred","to","as","`","P0","`",".","control_transition",":","np.ndarray",",","optional","(","default=None",")","of","shape","(","state_dim",",","control_variable_dim",")","or","(","time_steps",",","state_dim",",","control_variable_dim",")",".","Control","transition","matrix",",","also","referred","to","as","`","G","`",".","`","control_variable_dim","`","is","the","dimension","of","`","control","variable","`",",","also","referred","to","as","`","u","`",".","`","control","variable","`","is","an","optional","parameter","for","`","fit","`","and","`","transform","`","functions",".","denoising",":","bool",",","optional","(","default=False",")",".","This","parameter","affects","`","transform","`",".","If","False",",","then","`","transform","`","will","be","inferring","hidden","state",".","If","True",",","uses","`","FilterPy","`","`","rts_smoother","`","for","denoising",".","estimate_matrices",":","str","or","list","of","str",",","optional","(","default=None",")",".","Subset","of","[","`","state_transition","`",",","`","measurement_function","`",",","`","process_noise","`",",","`","measurement_noise","`",",","`","initial_state","`",",","`","initial_state_covariance","`","]","or","-","`","all","`",".","If","`","estimate_matrices","`","is","an","iterable","of","strings",",","only","matrices","in","`","estimate_matrices","`","will","be","estimated","using","EM","algorithm",".","If","`","estimate_matrices","`","is","`","all","`",",","then","all","matrices","will","be","estimated","using","EM","algorithm",".","Note","-","-","parameters","estimated","by","EM","algorithm","assumed","to","be","constant",".","-","`","control_transition","`","matrix","can","not","be","estimated",".","See","Also","--","--","--","--","KalmanFilterTransformerPK",":","Kalman","Filter","transformer",",","adapter","for","the","`","pykalman-bardo","`","package","into","`","sktime","`",".","Notes","--","--","-","`","FilterPy","`","KalmanFilter","documentation",":","https",":","\/\/filterpy.readthedocs.io\/en\/latest\/kalman\/KalmanFilter.html","References","--","--","--","--","--","..","[","1","]","Greg","Welch","and","Gary","Bishop",",","``","An","Introduction","to","the","Kalman","Filter","''",",","2006","https",":","\/\/www.cs.unc.edu\/~welch\/media\/pdf\/kalman_intro.pdf","..","[","2","]","R.H.Shumway","and","D.S.Stoffer","``","An","Approach","to","time","Series","Smoothing","and","Forecasting","Using","the","EM","Algorithm","''",",","1982","https",":","\/\/www.stat.pitt.edu\/stoffer\/dss_files\/em.pdf","Examples","--","--","--","--","Basic","example",":",">",">",">","import","numpy","as","np","#","doctest",":","+SKIP",">",">",">","import","sktime.transformations.series.kalman_filter","as","kf",">",">",">","time_steps",",","state_dim",",","measurement_dim","=","10",",","2",",","3",">",">",">",">",">",">","X","=","np.random.rand","(","time_steps",",","measurement_dim",")","*","10",">",">",">","transformer","=","kf.KalmanFilterTransformerFP","(","state_dim=state_dim",")","#","doctest",":","+SKIP",">",">",">","Xt","=","transformer.fit_transform","(","X=X",")","#","doctest",":","+SKIP","Example","of","-","denoising",",","matrix","estimation",",","missing","values","and","transform","with","y",":",">",">",">","import","numpy","as","np","#","doctest",":","+SKIP",">",">",">","import","sktime.transformations.series.kalman_filter","as","kf",">",">",">","time_steps",",","state_dim",",","measurement_dim","=","10",",","3",",","3",">",">",">","control_variable_dim","=","2",">",">",">",">",">",">","X","=","np.random.rand","(","time_steps",",","measurement_dim",")",">",">",">","#","missing","value",">",">",">","X","[","0","]","[","0","]","=","np.nan",">",">",">",">",">",">","#","y",">",">",">","control_variable","=","np.random.rand","(","time_steps",",","control_variable_dim",")",">",">",">",">",">",">","#","If","matrices","estimation","is","required",",","elements","of","`","estimate_matrices","`",">",">",">","#","are","assumed","to","be","constants",".",">",">",">","transformer","=","kf.KalmanFilterTransformerFP","(","#","doctest",":","+SKIP","...","state_dim=state_dim",",","...","measurement_noise=np.eye","(","measurement_dim",")",",","...","denoising=True",",","...","estimate_matrices='measurement_noise'","...",")",">",">",">","Xt","=","transformer.fit_transform","(","X=X",",","y=control_variable",")","#","doctest",":","+SKIP","Example","of","-","dynamic","inputs","(","matrix","per","time-step",")",",","missing","values",":",">",">",">","import","numpy","as","np","#","doctest",":","+SKIP",">",">",">","import","sktime.transformations.series.kalman_filter","as","kf",">",">",">","time_steps",",","state_dim",",","measurement_dim","=","10",",","4",",","4",">",">",">","control_variable_dim","=","4",">",">",">",">",">",">","X","=","np.random.rand","(","time_steps",",","measurement_dim",")",">",">",">","#","missing","values",">",">",">","X","[","0","]","=","[","np.NaN","for","i","in","range","(","measurement_dim",")","]",">",">",">",">",">",">","#","y",">",">",">","control_variable","=","np.random.rand","(","control_variable_dim",")",">",">",">",">",">",">","#","Dynamic","input","-",">",">",">","#","`","state_transition","`","provide","different","matrix","for","each","time","step",".",">",">",">","transformer","=","kf.KalmanFilterTransformerFP","(","#","doctest",":","+SKIP","...","state_dim=state_dim",",","...","state_transition=np.random.rand","(","time_steps",",","state_dim",",","state_dim",")",",","...","estimate_matrices=","[","'initial_state","'",",","'initial_state_covariance","'","]","...",")",">",">",">","Xt","=","transformer.fit_transform","(","X=X",",","y=control_variable",")","#","doctest",":","+SKIP"]
docstr: Extract data to be used at time step 't' of the Kalman filter iterations.
  
  Parameters
  ----------
  X : np.ndarray
      of shape (time_steps, measurement_dim).
      Data (measurements).
  G : np.ndarray
      of shape (state_dim, control_variable_dim) or
      (time_steps, state_dim, control_variable_dim).
      control_transition matrix
  u : np.ndarray
      of shape (control_variable_dim,) or (time_steps, control_variable_dim).
      u is the `control variable`. If `u` not given in _transform default
      value is [0].
  t : int
      time step
  
  Returns
  -------
      Seven matrices to be used at time step t
docstr_tok: ["Extract","data","to","be","used","at","time","step","'t","'","of","the","Kalman","filter","iterations",".","Parameters","--","--","--","--","--","X",":","np.ndarray","of","shape","(","time_steps",",","measurement_dim",")",".","Data","(","measurements",")",".","G",":","np.ndarray","of","shape","(","state_dim",",","control_variable_dim",")","or","(","time_steps",",","state_dim",",","control_variable_dim",")",".","control_transition","matrix","u",":","np.ndarray","of","shape","(","control_variable_dim",",",")","or","(","time_steps",",","control_variable_dim",")",".","u","is","the","`","control","variable","`",".","If","`","u","`","not","given","in","_transform","default","value","is","[","0","]",".","t",":","int","time","step","Returns","--","--","--","-","Seven","matrices","to","be","used","at","time","step","t"]
code: def _get_iter_t_matrices(self, X, G, u, t, time_steps, shapes):
      """Extract data to be used at time step 't' of the Kalman filter iterations.
  
      Parameters
      ----------
      X : np.ndarray
          of shape (time_steps, measurement_dim).
          Data (measurements).
      G : np.ndarray
          of shape (state_dim, control_variable_dim) or
          (time_steps, state_dim, control_variable_dim).
          control_transition matrix
      u : np.ndarray
          of shape (control_variable_dim,) or (time_steps, control_variable_dim).
          u is the `control variable`. If `u` not given in _transform default
          value is [0].
      t : int
          time step
  
      Returns
      -------
          Seven matrices to be used at time step t
      """
      zt = None if any(np.isnan(X[t])) else X[t]
      Ft = _get_t_matrix(
          time_t=t,
          matrices=self.F_,
          shape=shapes["F"],
          time_steps=time_steps,
      )
      Gt = _get_t_matrix(
          time_t=t, matrices=G, shape=shapes["G"], time_steps=time_steps
      )
      Qt = _get_t_matrix(
          time_t=t,
          matrices=self.Q_,
          shape=shapes["Q"],
          time_steps=time_steps,
      )
      Rt = _get_t_matrix(
          time_t=t,
          matrices=self.R_,
          shape=shapes["R"],
          time_steps=time_steps,
      )
      Ht = _get_t_matrix(
          time_t=t,
          matrices=self.H_,
          shape=shapes["H"],
          time_steps=time_steps,
      )
      ut = _get_t_matrix(
          time_t=t, matrices=u, shape=shapes["u"], time_steps=time_steps
      )
  
      return zt, Ft, Gt, Qt, Rt, Ht, ut
  
imports: import numpy
  from sktime.transformations.base import BaseTransformer
  from sktime.utils.validation._dependencies import _check_soft_dependencies
  from sktime.utils.warnings import warn
label_desc: Use image node_id 5 for calling the KalmanFilterTransformerFP obj's underlying member method code with example usage: obj._get_iter_t_matrices(X, G, u, t, time_steps, shapes) and returns: zt,  Ft,  Gt,  Qt,  Rt,  Ht,  ut