docstr: Verify that MIDAS works as expected with multiple series of different "high" frequencies (monthly and quarterly
  to yearly).
docstr_tok: ["Verify","that","MIDAS","works","as","expected","with","multiple","series","of","different","``","high","''","frequencies","(","monthly","and","quarterly","to","yearly",")","."]
code: def test_multiple_ts(self):
      """
      Verify that MIDAS works as expected with multiple series of different "high" frequencies (monthly and quarterly
      to yearly).
      """
      quarterly_univariate_ts = TimeSeries.from_times_and_values(
          times=pd.date_range(start="2000-01-01", periods=12, freq="Q"),
          values=np.arange(0, 12),
      )
      quarterly_multivariate_ts = TimeSeries.from_times_and_values(
          times=pd.date_range(start="2020-01-01", periods=12, freq="Q"),
          values=np.arange(0, 24).reshape(-1, 2),
      )
  
      ts_to_transform = [self.monthly_ts, quarterly_univariate_ts]
      # ==> with stripping: not enough months, first series will be empty
      midas_yearly = MIDAS(low_freq="AS", strip=True)
  
      list_yearly_ts = midas_yearly.fit_transform(ts_to_transform)
      assert len(list_yearly_ts) == 2
      assert len(list_yearly_ts[0]) == 0
      assert list_yearly_ts[0].freq == "AS"
      assert list_yearly_ts[0].n_components == 12
  
      # 4 quarters in a year
      np.testing.assert_array_almost_equal(
          list_yearly_ts[1].values(),
          quarterly_univariate_ts.values().reshape(3, 4),
      )
      # verify inverse-transform: first series will be empty, second should be identical to original
      inverse_transformed = midas_yearly.inverse_transform(
          list_yearly_ts
      )
      assert len(inverse_transformed) == 2
      assert len(inverse_transformed[0]) == 0
      assert inverse_transformed[0].freq == "M"
      assert inverse_transformed[0].n_components == 1
  
      assert ts_to_transform[1:] == inverse_transformed[1:]
  
      # ==> without stripping: first series will be partially empty
      midas_yearly = MIDAS(low_freq="AS", strip=False)
      list_yearly_ts = midas_yearly.fit_transform(ts_to_transform)
      # 12 months in a year, original ts contains only 9 values, the missing data are nan
      np.testing.assert_array_almost_equal(
          list_yearly_ts[0].values()[:, :9], self.monthly_ts.values().T
      )
      assert np.isnan(list_yearly_ts[0].values()[:, 9:]).sum() == 3
      # 4 quarters in a year
      np.testing.assert_array_almost_equal(
          list_yearly_ts[1].values(),
          quarterly_univariate_ts.values().reshape(3, 4),
      )
      # verify inverse-transform
      assert ts_to_transform == midas_yearly.inverse_transform(
          list_yearly_ts
      )
  
      # replacing the univariate ts with a multivariate ts (same frequency, different start)
      ts_to_transform = [self.monthly_ts, quarterly_multivariate_ts]
      list_yearly_ts = midas_yearly.transform(ts_to_transform)
      np.testing.assert_array_almost_equal(
          list_yearly_ts[1].values(),
          quarterly_multivariate_ts.values().reshape(3, 8),
      )
  
      assert (
          quarterly_multivariate_ts
          == midas_yearly.inverse_transform(list_yearly_ts)[1]
      )
  
imports: import numpy
  import pandas
  import pytest
  from darts import TimeSeries
  from darts.dataprocessing.transformers import MIDAS
  from darts.models import LinearRegressionModel
  from darts.utils.timeseries_generation import generate_index, linear_timeseries
label_desc: Use image node_id 13 for calling the TestMIDAS obj's underlying member method code with example usage: obj.test_multiple_ts() without return types