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: Helper function called by `get_feature_times` that extracts all of the times within
  `past_covariates` that can be used to create features. More specifically, we can create
  features for times within `past_covariates` that have at least `max_lag = -min(past_covariates_lags)`
  values preceeding them, since these preceeding values are required to construct a feature vector for
  that time. Since the first `max_lag` times do not fulfill this condition, they are exluded.
  
  Unlike the `target_series`, features can be constructed for times that occur after the end of
  `past_covariates`; this is because:
      1. We don't need to have all the `past_covariates` values up to time `t` to construct
      a feature for this time; instead, we only need to have the values from time `t - min_lag`
      to `t - max_lag`, where `min_lag = -max(past_covariates_lags)` and
      `max_lag = -min(past_covariates_lags)`. In other words, the latest feature we can create
      for `past_covariates` occurs at `past_covariates.end_time() + min_lag * past_covariates.freq`.
      2. We don't need to use the values of `past_covariates` to construct labels, so we're able
      to create a feature for time `t` without having to worry about whether we can construct
      a corresponding label for this time.
docstr_tok: ["Helper","function","called","by","`","get_feature_times","`","that","extracts","all","of","the","times","within","`","past_covariates","`","that","can","be","used","to","create","features",".","More","specifically",",","we","can","create","features","for","times","within","`","past_covariates","`","that","have","at","least","`","max_lag","=","-min","(","past_covariates_lags",")","`","values","preceeding","them",",","since","these","preceeding","values","are","required","to","construct","a","feature","vector","for","that","time",".","Since","the","first","`","max_lag","`","times","do","not","fulfill","this","condition",",","they","are","exluded",".","Unlike","the","`","target_series","`",",","features","can","be","constructed","for","times","that","occur","after","the","end","of","`","past_covariates","`",";","this","is","because",":","1",".","We","do","n't","need","to","have","all","the","`","past_covariates","`","values","up","to","time","`","t","`","to","construct","a","feature","for","this","time",";","instead",",","we","only","need","to","have","the","values","from","time","`","t","-","min_lag","`","to","`","t","-","max_lag","`",",","where","`","min_lag","=","-max","(","past_covariates_lags",")","`","and","`","max_lag","=","-min","(","past_covariates_lags",")","`",".","In","other","words",",","the","latest","feature","we","can","create","for","`","past_covariates","`","occurs","at","`","past_covariates.end_time","(",")","+","min_lag","*","past_covariates.freq","`",".","2",".","We","do","n't","need","to","use","the","values","of","`","past_covariates","`","to","construct","labels",",","so","we","'re","able","to","create","a","feature","for","time","`","t","`","without","having","to","worry","about","whether","we","can","construct","a","corresponding","label","for","this","time","."]
code: def get_feature_times_past(
      past_covariates: TimeSeries,
      past_covariates_lags: Sequence[int],
  ) -> pd.Index:
      """
      Helper function called by `get_feature_times` that extracts all of the times within
      `past_covariates` that can be used to create features. More specifically, we can create
      features for times within `past_covariates` that have at least `max_lag = -min(past_covariates_lags)`
      values preceeding them, since these preceeding values are required to construct a feature vector for
      that time. Since the first `max_lag` times do not fulfill this condition, they are exluded.
  
      Unlike the `target_series`, features can be constructed for times that occur after the end of
      `past_covariates`; this is because:
          1. We don't need to have all the `past_covariates` values up to time `t` to construct
          a feature for this time; instead, we only need to have the values from time `t - min_lag`
          to `t - max_lag`, where `min_lag = -max(past_covariates_lags)` and
          `max_lag = -min(past_covariates_lags)`. In other words, the latest feature we can create
          for `past_covariates` occurs at `past_covariates.end_time() + min_lag * past_covariates.freq`.
          2. We don't need to use the values of `past_covariates` to construct labels, so we're able
          to create a feature for time `t` without having to worry about whether we can construct
          a corresponding label for this time.
      """
      times = past_covariates.time_index
      min_lag = -max(past_covariates_lags)
      # Add times after end of series for which we can create features:
      times = times.union(
          [
              times[-1] + i * past_covariates.freq
              for i in range(1, min_lag + 1)
          ]
      )
      max_lag = -min(past_covariates_lags)
      times = times[max_lag:]
      return times
  
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 4 for calling the TestCreateLaggedTrainingData obj's underlying member method code with example usage: obj.get_feature_times_past(past_covariates, past_covariates_lags) and returns: times