class_docstr: Kalman Filter is used for denoising data, or inferring the hidden state of 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 `pykalman-bardo` package into `sktime`.
  `KalmanFilterTransformerPK` implements hidden inferred states and
  denoising, depending on the boolean input parameter `denoising`.
  In addition, `KalmanFilterTransformerPK` provides parameter
  optimization via Expectation-Maximization (EM) algorithm [2]_,
  implemented by `pykalman-bardo`.
  
  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`.
  transition_offsets : np.ndarray, optional (default=None)
      of shape (state_dim,) or (time_steps, state_dim).
      State offsets, also referred to as `b`, as described in `pykalman-bardo`.
  measurement_offsets : np.ndarray, optional (default=None)
      of shape (measurement_dim,) or (time_steps, measurement_dim).
      Observation (measurement) offsets, also referred to as `d`,
      as described in `pykalman-bardo`.
  denoising : bool, optional (default=False).
      This parameter affects `transform`. If False, then `transform` will be inferring
      hidden state. If True, uses `pykalman-bardo` `smooth` 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`, `transition_offsets`, `measurement_offsets`]
      or - `all`. If `estimate_matrices` is an iterable of strings,
      only matrices in `estimate_matrices` will be estimated using EM algorithm,
      like described in `pykalman-bardo`. If `estimate_matrices` is `all`,
      then all matrices will be estimated using EM algorithm.
  
      Note - parameters estimated by EM algorithm assumed to be constant.
  
  See Also
  --------
  KalmanFilterTransformerFP :
      Kalman Filter transformer, adapter for the `FilterPy` package into `sktime`.
  
  Notes
  -----
  `pykalman-bardo` KalmanFilter documentation :
      https://pykalman.github.io/#kalmanfilter
  
  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.KalmanFilterTransformerPK(state_dim=state_dim) # doctest: +SKIP
  >>> X_transformed = transformer.fit_transform(X=X)  # doctest: +SKIP
  
      Example of - denoising, matrix estimation and missing values:
  
  >>> import numpy as np  # doctest: +SKIP
  >>> import sktime.transformations.series.kalman_filter as kf
  >>> time_steps, state_dim, measurement_dim = 10, 2, 2
  >>>
  >>> X = np.random.rand(time_steps, measurement_dim)
  >>> # missing value
  >>> X[0][0] = np.nan
  >>>
  >>> # If matrices estimation is required, elements of `estimate_matrices`
  >>> # are assumed to be constants.
  >>> transformer = kf.KalmanFilterTransformerPK(  # doctest: +SKIP
  ...     state_dim=state_dim,
  ...     measurement_noise=np.eye(measurement_dim),
  ...     denoising=True,
  ...     estimate_matrices=['measurement_noise']
  ...     )
  >>>
  >>> X_transformed = transformer.fit_transform(X=X)  # doctest: +SKIP
  
      Example of - dynamic inputs (matrix per time-step) and 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
  >>>
  >>> X = np.random.rand(time_steps, measurement_dim)
  >>> # missing values
  >>> X[0] = [np.NaN for i in range(measurement_dim)]
  >>>
  >>> # Dynamic input -
  >>> # `state_transition` provide different matrix for each time step.
  >>> transformer = kf.KalmanFilterTransformerPK(  # doctest: +SKIP
  ...     state_dim=state_dim,
  ...     state_transition=np.random.rand(time_steps, state_dim, state_dim),
  ...     estimate_matrices=['initial_state', 'initial_state_covariance']
  ...     )
  >>>
  >>> X_transformed = transformer.fit_transform(X=X)  # doctest: +SKIP
class_docstr_tok: ["Kalman","Filter","is","used","for","denoising","data",",","or","inferring","the","hidden","state","of","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","`","pykalman-bardo","`","package","into","`","sktime","`",".","`","KalmanFilterTransformerPK","`","implements","hidden","inferred","states","and","denoising",",","depending","on","the","boolean","input","parameter","`","denoising","`",".","In","addition",",","`","KalmanFilterTransformerPK","`","provides","parameter","optimization","via","Expectation-Maximization","(","EM",")","algorithm","[","2","]","_",",","implemented","by","`","pykalman-bardo","`",".","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","`",".","transition_offsets",":","np.ndarray",",","optional","(","default=None",")","of","shape","(","state_dim",",",")","or","(","time_steps",",","state_dim",")",".","State","offsets",",","also","referred","to","as","`","b","`",",","as","described","in","`","pykalman-bardo","`",".","measurement_offsets",":","np.ndarray",",","optional","(","default=None",")","of","shape","(","measurement_dim",",",")","or","(","time_steps",",","measurement_dim",")",".","Observation","(","measurement",")","offsets",",","also","referred","to","as","`","d","`",",","as","described","in","`","pykalman-bardo","`",".","denoising",":","bool",",","optional","(","default=False",")",".","This","parameter","affects","`","transform","`",".","If","False",",","then","`","transform","`","will","be","inferring","hidden","state",".","If","True",",","uses","`","pykalman-bardo","`","`","smooth","`","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","`",",","`","transition_offsets","`",",","`","measurement_offsets","`","]","or","-","`","all","`",".","If","`","estimate_matrices","`","is","an","iterable","of","strings",",","only","matrices","in","`","estimate_matrices","`","will","be","estimated","using","EM","algorithm",",","like","described","in","`","pykalman-bardo","`",".","If","`","estimate_matrices","`","is","`","all","`",",","then","all","matrices","will","be","estimated","using","EM","algorithm",".","Note","-","parameters","estimated","by","EM","algorithm","assumed","to","be","constant",".","See","Also","--","--","--","--","KalmanFilterTransformerFP",":","Kalman","Filter","transformer",",","adapter","for","the","`","FilterPy","`","package","into","`","sktime","`",".","Notes","--","--","-","`","pykalman-bardo","`","KalmanFilter","documentation",":","https",":","\/\/pykalman.github.io\/","#","kalmanfilter","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.KalmanFilterTransformerPK","(","state_dim=state_dim",")","#","doctest",":","+SKIP",">",">",">","X_transformed","=","transformer.fit_transform","(","X=X",")","#","doctest",":","+SKIP","Example","of","-","denoising",",","matrix","estimation","and","missing","values",":",">",">",">","import","numpy","as","np","#","doctest",":","+SKIP",">",">",">","import","sktime.transformations.series.kalman_filter","as","kf",">",">",">","time_steps",",","state_dim",",","measurement_dim","=","10",",","2",",","2",">",">",">",">",">",">","X","=","np.random.rand","(","time_steps",",","measurement_dim",")",">",">",">","#","missing","value",">",">",">","X","[","0","]","[","0","]","=","np.nan",">",">",">",">",">",">","#","If","matrices","estimation","is","required",",","elements","of","`","estimate_matrices","`",">",">",">","#","are","assumed","to","be","constants",".",">",">",">","transformer","=","kf.KalmanFilterTransformerPK","(","#","doctest",":","+SKIP","...","state_dim=state_dim",",","...","measurement_noise=np.eye","(","measurement_dim",")",",","...","denoising=True",",","...","estimate_matrices=","[","'measurement_noise","'","]","...",")",">",">",">",">",">",">","X_transformed","=","transformer.fit_transform","(","X=X",")","#","doctest",":","+SKIP","Example","of","-","dynamic","inputs","(","matrix","per","time-step",")","and","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",">",">",">",">",">",">","X","=","np.random.rand","(","time_steps",",","measurement_dim",")",">",">",">","#","missing","values",">",">",">","X","[","0","]","=","[","np.NaN","for","i","in","range","(","measurement_dim",")","]",">",">",">",">",">",">","#","Dynamic","input","-",">",">",">","#","`","state_transition","`","provide","different","matrix","for","each","time","step",".",">",">",">","transformer","=","kf.KalmanFilterTransformerPK","(","#","doctest",":","+SKIP","...","state_dim=state_dim",",","...","state_transition=np.random.rand","(","time_steps",",","state_dim",",","state_dim",")",",","...","estimate_matrices=","[","'initial_state","'",",","'initial_state_covariance","'","]","...",")",">",">",">",">",">",">","X_transformed","=","transformer.fit_transform","(","X=X",")","#","doctest",":","+SKIP"]
docstr: Map parameter names to `pykalman-bardo` names for use of `em`.
  
  Returns
  -------
      em_vars : list
          mapped parameters names
docstr_tok: ["Map","parameter","names","to","`","pykalman-bardo","`","names","for","use","of","`","em","`",".","Returns","--","--","--","-","em_vars",":","list","mapped","parameters","names"]
code: def _get_estimate_matrices(self):
      """Map parameter names to `pykalman-bardo` names for use of `em`.
  
      Returns
      -------
          em_vars : list
              mapped parameters names
      """
      params_mapping = {
          "state_transition": "transition_matrices",
          "process_noise": "transition_covariance",
          "measurement_offsets": "observation_offsets",
          "transition_offsets": "transition_offsets",
          "measurement_noise": "observation_covariance",
          "measurement_function": "observation_matrices",
          "initial_state": "initial_state_mean",
          "initial_state_covariance": "initial_state_covariance",
      }
      valid_ems = _validate_estimate_matrices(
          input_ems=self.estimate_matrices,
          all_ems=list(params_mapping.keys()),
      )
  
      em_vars = [params_mapping[em_var] for em_var in valid_ems]
      return em_vars
  
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 6 for calling the KalmanFilterTransformerPK obj's underlying member method code with example usage: obj._get_estimate_matrices() and returns: em_vars