docstr: Check that inverse-transforming the prediction of a model generate the correct time index when
  using frequency anchored either at the start or the end of the quarter.
docstr_tok: ["Check","that","inverse-transforming","the","prediction","of","a","model","generate","the","correct","time","index","when","using","frequency","anchored","either","at","the","start","or","the","end","of","the","quarter","."]
code: def test_inverse_transform_prediction(self):
      """
      Check that inverse-transforming the prediction of a model generate the correct time index when
      using frequency anchored either at the start or the end of the quarter.
      """
      # low frequency : QuarterStart
      monthly_ts = TimeSeries.from_times_and_values(
          times=pd.date_range(start="01-2020", periods=24, freq="M"),
          values=np.arange(0, 24),
          columns=["values"],
      )
      monthly_train_ts, monthly_test_ts = monthly_ts.split_after(0.75)
  
      model = LinearRegressionModel(lags=2)
  
      midas_quarterly = MIDAS(low_freq="QS")
      # shape : [6 quarters, 3 months, 1 sample]
      quarterly_train_ts = midas_quarterly.fit_transform(
          monthly_train_ts
      )
      # shape : [2 quarters, 3 months, 1 sample]
      quarterly_test_ts = midas_quarterly.transform(monthly_test_ts)
  
      model.fit(quarterly_train_ts)
  
      # 2 quarters = 6 months forecast
      pred_quarterly = model.predict(2)
      pred_monthly = midas_quarterly.inverse_transform(pred_quarterly)
      # verify prediction time index in both frequencies
      assert pred_quarterly.time_index.equals(
          quarterly_test_ts.time_index
      )
      assert pred_monthly.time_index.equals(monthly_test_ts.time_index)
  
      # "Q" = QuarterEnd, the 2 "hidden" months must be retrieved
      midas_quarterly = MIDAS(low_freq="Q")
      quarterly_train_ts = midas_quarterly.fit_transform(
          monthly_train_ts
      )
      quarterly_test_ts = midas_quarterly.transform(monthly_test_ts)
  
      model.fit(quarterly_train_ts)
  
      pred_quarterly = model.predict(2)
      pred_monthly = midas_quarterly.inverse_transform(pred_quarterly)
      # verify prediction time index in both frequencies
      assert pred_quarterly.time_index.equals(
          quarterly_test_ts.time_index
      )
      assert pred_monthly.time_index.equals(monthly_test_ts.time_index)
  
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 11 for calling the TestMIDAS obj's underlying member method code with example usage: obj.test_inverse_transform_prediction() without return types