class_docstr: Tests the `create_lagged_training_data` function defined in `darts.utils.data.tabularization`. There are broadly
  two 'groups' of tests defined in this module:
      1. 'Generated Test Cases': these test that `create_lagged_training_data` produces the same outputs
      as a simplified implementation of the 'time intersection' feature generation method (see
      `darts.utils.data.tabularization` for further details). For these tests, the 'correct answer' is not
      directly specified; instead, it is generated from a set of input parameters using the set of simplified
      functions. The rationale behind this approach is that it allows for many different combinations of input
      values to be effortlessly tested. The drawback of this, however, is that the correctness of these tests
      assumes that the simplified functions have been implemented correctly - if this isn't the case, then these
      tests are not to be trusted. In saying this, these simplified functions are significantly easier to
      understand and debug than the `create_lagged_training_data` function they're helping to test.
      2. 'Specified Test Cases': these test that `create_lagged_training_data` returns an exactly specified
      output; these specified outputs are *not* 'generated' by another function. Although these 'specified'
      test cases tend to be simpler and less extensive than the 'generated' test cases, their correctness does
      not assume the correct implementation of any other function.
class_docstr_tok: ["Tests","the","`","create_lagged_training_data","`","function","defined","in","`","darts.utils.data.tabularization","`",".","There","are","broadly","two","'groups","'","of","tests","defined","in","this","module",":","1",".","'Generated","Test","Cases","'",":","these","test","that","`","create_lagged_training_data","`","produces","the","same","outputs","as","a","simplified","implementation","of","the","'time","intersection","'","feature","generation","method","(","see","`","darts.utils.data.tabularization","`","for","further","details",")",".","For","these","tests",",","the","'correct","answer","'","is","not","directly","specified",";","instead",",","it","is","generated","from","a","set","of","input","parameters","using","the","set","of","simplified","functions",".","The","rationale","behind","this","approach","is","that","it","allows","for","many","different","combinations","of","input","values","to","be","effortlessly","tested",".","The","drawback","of","this",",","however",",","is","that","the","correctness","of","these","tests","assumes","that","the","simplified","functions","have","been","implemented","correctly","-","if","this","is","n't","the","case",",","then","these","tests","are","not","to","be","trusted",".","In","saying","this",",","these","simplified","functions","are","significantly","easier","to","understand","and","debug","than","the","`","create_lagged_training_data","`","function","they","'re","helping","to","test",".","2",".","'Specified","Test","Cases","'",":","these","test","that","`","create_lagged_training_data","`","returns","an","exactly","specified","output",";","these","specified","outputs","are","*","not","*","'generated","'","by","another","function",".","Although","these","'specified'","test","cases","tend","to","be","simpler","and","less","extensive","than","the","'generated","'","test","cases",",","their","correctness","does","not","assume","the","correct","implementation","of","any","other","function","."]
docstr: Tests that `create_lagged_component_names` produces the expected features name depending
  on the lags, output_chunk_length and covariates.
docstr_tok: ["Tests","that","`","create_lagged_component_names","`","produces","the","expected","features","name","depending","on","the","lags",",","output_chunk_length","and","covariates","."]
code: def test_create_lagged_component_names(self):
      """
      Tests that `create_lagged_component_names` produces the expected features name depending
      on the lags, output_chunk_length and covariates.
      """
      target_with_no_cov = self.create_multivariate_linear_timeseries(
          n_components=1,
          components_names=["no_static"],
          start_value=0,
          end_value=10,
          start=2,
          length=10,
          freq=2,
      )
      n_comp = 2
      target_with_static_cov = (
          self.create_multivariate_linear_timeseries(
              n_components=n_comp,
              components_names=["static_0", "static_1"],
              start_value=0,
              end_value=10,
              start=2,
              length=10,
              freq=2,
          )
      )
      target_with_static_cov = (
          target_with_static_cov.with_static_covariates(
              pd.DataFrame(
                  {"dummy": [1]}
              )  # leads to "global" static cov component name
          )
      )
      target_with_static_cov2 = (
          target_with_static_cov.with_static_covariates(
              pd.DataFrame(
                  {"dummy": [i for i in range(n_comp)]}
              )  # leads to sharing target component names
          )
      )
      target_with_static_cov3 = (
          target_with_static_cov.with_static_covariates(
              pd.DataFrame(
                  {
                      "dummy": [i for i in range(n_comp)],
                      "dummy1": [i for i in range(n_comp)],
                  }
              )  # leads to sharing target component names
          )
      )
  
      past = self.create_multivariate_linear_timeseries(
          n_components=3,
          components_names=["past_0", "past_1", "past_2"],
          start_value=10,
          end_value=20,
          start=2,
          length=10,
          freq=2,
      )
      future = self.create_multivariate_linear_timeseries(
          n_components=4,
          components_names=[
              "future_0",
              "future_1",
              "future_2",
              "future_3",
          ],
          start_value=20,
          end_value=30,
          start=2,
          length=10,
          freq=2,
      )
  
      # target no static covariate
      expected_lagged_features = [
          "no_static_target_lag-2",
          "no_static_target_lag-1",
      ]
      created_lagged_features, _ = create_lagged_component_names(
          target_series=target_with_no_cov,
          past_covariates=None,
          future_covariates=None,
          lags=[-2, -1],
          lags_past_covariates=None,
          lags_future_covariates=None,
          concatenate=False,
          use_static_covariates=False,
      )
      assert expected_lagged_features == created_lagged_features
  
      # target with static covariate (but don't use them in feature names)
      expected_lagged_features = [
          "static_0_target_lag-4",
          "static_1_target_lag-4",
          "static_0_target_lag-1",
          "static_1_target_lag-1",
      ]
      created_lagged_features, _ = create_lagged_component_names(
          target_series=target_with_static_cov,
          past_covariates=None,
          future_covariates=None,
          lags=[-4, -1],
          lags_past_covariates=None,
          lags_future_covariates=None,
          concatenate=False,
          use_static_covariates=False,
      )
      assert expected_lagged_features == created_lagged_features
  
      # target with static covariate (acting on global target components)
      expected_lagged_features = [
          "static_0_target_lag-4",
          "static_1_target_lag-4",
          "static_0_target_lag-1",
          "static_1_target_lag-1",
          "dummy_statcov_target_global_components",
      ]
      created_lagged_features, _ = create_lagged_component_names(
          target_series=target_with_static_cov,
          past_covariates=None,
          future_covariates=None,
          lags=[-4, -1],
          lags_past_covariates=None,
          lags_future_covariates=None,
          concatenate=False,
          use_static_covariates=True,
      )
      assert expected_lagged_features == created_lagged_features
  
      # target with static covariate (component specific)
      expected_lagged_features = [
          "static_0_target_lag-4",
          "static_1_target_lag-4",
          "static_0_target_lag-1",
          "static_1_target_lag-1",
          "dummy_statcov_target_static_0",
          "dummy_statcov_target_static_1",
      ]
      created_lagged_features, _ = create_lagged_component_names(
          target_series=target_with_static_cov2,
          past_covariates=None,
          future_covariates=None,
          lags=[-4, -1],
          lags_past_covariates=None,
          lags_future_covariates=None,
          concatenate=False,
          use_static_covariates=True,
      )
      assert expected_lagged_features == created_lagged_features
  
      # target with static covariate (component specific & multivariate)
      expected_lagged_features = [
          "static_0_target_lag-4",
          "static_1_target_lag-4",
          "static_0_target_lag-1",
          "static_1_target_lag-1",
          "dummy_statcov_target_static_0",
          "dummy_statcov_target_static_1",
          "dummy1_statcov_target_static_0",
          "dummy1_statcov_target_static_1",
      ]
      created_lagged_features, _ = create_lagged_component_names(
          target_series=target_with_static_cov3,
          past_covariates=None,
          future_covariates=None,
          lags=[-4, -1],
          lags_past_covariates=None,
          lags_future_covariates=None,
          concatenate=False,
          use_static_covariates=True,
      )
      assert expected_lagged_features == created_lagged_features
  
      # target + past
      expected_lagged_features = [
          "no_static_target_lag-4",
          "no_static_target_lag-3",
          "past_0_pastcov_lag-1",
          "past_1_pastcov_lag-1",
          "past_2_pastcov_lag-1",
      ]
      created_lagged_features, _ = create_lagged_component_names(
          target_series=target_with_no_cov,
          past_covariates=past,
          future_covariates=None,
          lags=[-4, -3],
          lags_past_covariates=[-1],
          lags_future_covariates=None,
          concatenate=False,
      )
      assert expected_lagged_features == created_lagged_features
  
      # target + future
      expected_lagged_features = [
          "no_static_target_lag-2",
          "no_static_target_lag-1",
          "future_0_futcov_lag3",
          "future_1_futcov_lag3",
          "future_2_futcov_lag3",
          "future_3_futcov_lag3",
      ]
      created_lagged_features, _ = create_lagged_component_names(
          target_series=target_with_no_cov,
          past_covariates=None,
          future_covariates=future,
          lags=[-2, -1],
          lags_past_covariates=None,
          lags_future_covariates=[3],
          concatenate=False,
      )
      assert expected_lagged_features == created_lagged_features
  
      # past + future
      expected_lagged_features = [
          "past_0_pastcov_lag-1",
          "past_1_pastcov_lag-1",
          "past_2_pastcov_lag-1",
          "future_0_futcov_lag2",
          "future_1_futcov_lag2",
          "future_2_futcov_lag2",
          "future_3_futcov_lag2",
      ]
      created_lagged_features, _ = create_lagged_component_names(
          target_series=target_with_no_cov,
          past_covariates=past,
          future_covariates=future,
          lags=None,
          lags_past_covariates=[-1],
          lags_future_covariates=[2],
          concatenate=False,
      )
      assert expected_lagged_features == created_lagged_features
  
      # target with static + past + future
      expected_lagged_features = [
          "static_0_target_lag-2",
          "static_1_target_lag-2",
          "static_0_target_lag-1",
          "static_1_target_lag-1",
          "past_0_pastcov_lag-1",
          "past_1_pastcov_lag-1",
          "past_2_pastcov_lag-1",
          "future_0_futcov_lag2",
          "future_1_futcov_lag2",
          "future_2_futcov_lag2",
          "future_3_futcov_lag2",
      ]
      created_lagged_features, _ = create_lagged_component_names(
          target_series=target_with_static_cov,
          past_covariates=past,
          future_covariates=future,
          lags=[-2, -1],
          lags_past_covariates=[-1],
          lags_future_covariates=[2],
          concatenate=False,
      )
      assert expected_lagged_features == created_lagged_features
  
      # multiple series with same components, including past/future covariates
      expected_lagged_features = [
          "static_0_target_lag-3",
          "static_1_target_lag-3",
          "past_0_pastcov_lag-1",
          "past_1_pastcov_lag-1",
          "past_2_pastcov_lag-1",
          "future_0_futcov_lag2",
          "future_1_futcov_lag2",
          "future_2_futcov_lag2",
          "future_3_futcov_lag2",
      ]
      created_lagged_features, _ = create_lagged_component_names(
          target_series=[
              target_with_static_cov,
              target_with_static_cov,
          ],
          past_covariates=[past, past],
          future_covariates=[future, future],
          lags=[-3],
          lags_past_covariates=[-1],
          lags_future_covariates=[2],
          concatenate=False,
      )
      assert expected_lagged_features == created_lagged_features
  
      # multiple series with different components will use the first series as reference
      expected_lagged_features = [
          "static_0_target_lag-2",
          "static_1_target_lag-2",
          "static_0_target_lag-1",
          "static_1_target_lag-1",
          "past_0_pastcov_lag-1",
          "past_1_pastcov_lag-1",
          "past_2_pastcov_lag-1",
          "future_0_futcov_lag2",
          "future_1_futcov_lag2",
          "future_2_futcov_lag2",
          "future_3_futcov_lag2",
      ]
      created_lagged_features, _ = create_lagged_component_names(
          target_series=[
              target_with_static_cov,
              target_with_no_cov.stack(target_with_no_cov),
          ],
          past_covariates=[past, past],
          future_covariates=[future, past.stack(target_with_no_cov)],
          lags=[-2, -1],
          lags_past_covariates=[-1],
          lags_future_covariates=[2],
          concatenate=False,
      )
      assert expected_lagged_features == created_lagged_features
  
imports: import warnings
  from itertools import product
  from typing import Optional, Sequence
  import numpy
  import pandas
  import pytest
  from darts import TimeSeries
  from darts import concatenate
  from darts.logging import get_logger, raise_if, raise_if_not, raise_log
  from darts.utils.data.tabularization import create_lagged_component_names, create_lagged_training_data
  from darts.utils.timeseries_generation import linear_timeseries
label_desc: Use image node_id 33 for calling the TestCreateLaggedTrainingData obj's underlying member method code with example usage: obj.test_create_lagged_component_names() without return types