docstr: KalmanFilter test.
  Creates an increasing sequence of numbers, adds noise and
  assumes the kalman filter predicts values closer to real values
docstr_tok: ["KalmanFilter","test",".","Creates","an","increasing","sequence","of","numbers",",","adds","noise","and","assumes","the","kalman","filter","predicts","values","closer","to","real","values"]
code: def test_kalman(self):
      """KalmanFilter test.
      Creates an increasing sequence of numbers, adds noise and
      assumes the kalman filter predicts values closer to real values
      """
      testing_signal = np.arange(1, 5, 0.1)
  
      noise = np.random.normal(0, 0.7, testing_signal.shape)
      testing_signal_with_noise = testing_signal + noise
  
      df = pd.DataFrame(
          data=testing_signal_with_noise, columns=["signal"]
      )
      testing_signal_with_noise_ts = TimeSeries.from_dataframe(
          df, value_cols=["signal"]
      )
  
      kf = KalmanFilter(dim_x=1)
      kf.fit(testing_signal_with_noise_ts)
      filtered_ts = kf.filter(
          testing_signal_with_noise_ts, num_samples=1
      )
      filtered_values = filtered_ts.univariate_values()
  
      noise_distance = testing_signal_with_noise - testing_signal
      prediction_distance = filtered_values - testing_signal
  
      assert noise_distance.std() > prediction_distance.std()
      assert filtered_ts.width == 1
      assert filtered_ts.n_samples == 1
  
imports: import numpy
  import pandas
  from nfoursid import kalman, state_space
  from sklearn.gaussian_process.kernels import RBF, ExpSineSquared
  from darts import TimeSeries
  from darts.metrics import rmse
  from darts.models.filtering.gaussian_process_filter import GaussianProcessFilter
  from darts.models.filtering.kalman_filter import KalmanFilter
  from darts.models.filtering.moving_average_filter import MovingAverageFilter
  from darts.utils import timeseries_generation
label_desc: Use image node_id 1 for calling the TestKalmanFilter obj's underlying member method code with example usage: obj.test_kalman() without return types