class_docstr: For each train / validation split, training data includes all available past data.
  
  For example, for ``prediction_length=2``, ``num_val_windows=3`` and ``val_step_size=1`` the folds are::
  
      |-------------------|
      | x x x x x y y - - |
      | x x x x x x y y - |
      | x x x x x x x y y |
  
  where ``x`` are the train time steps and ``y`` are the validation time steps.
  
  Train data includes only time steps denoted by ``x``, and validation data includes both ``x`` and ``y`` time steps.
  
  Parameters
  ----------
  prediction_length : int
      Length of the forecast horizon.
  num_val_windows: int, default = 1
      Number of windows to generate from each time series in the dataset.
  val_step_size : int, optional
      The end of each subsequent window is moved this many time steps forward.
class_docstr_tok: ["For","each","train","\/","validation","split",",","training","data","includes","all","available","past","data",".","For","example",",","for","``","prediction_length=2","``",",","``","num_val_windows=3","``","and","``","val_step_size=1","``","the","folds","are",":",":","|","--","--","--","--","--","--","--","--","--","-|","|","x","x","x","x","x","y","y","-","-","|","|","x","x","x","x","x","x","y","y","-","|","|","x","x","x","x","x","x","x","y","y","|","where","``","x","``","are","the","train","time","steps","and","``","y","``","are","the","validation","time","steps",".","Train","data","includes","only","time","steps","denoted","by","``","x","``",",","and","validation","data","includes","both","``","x","``","and","``","y","``","time","steps",".","Parameters","--","--","--","--","--","prediction_length",":","int","Length","of","the","forecast","horizon",".","num_val_windows",":","int",",","default","=","1","Number","of","windows","to","generate","from","each","time","series","in","the","dataset",".","val_step_size",":","int",",","optional","The","end","of","each","subsequent","window","is","moved","this","many","time","steps","forward","."]
docstr: Generate train and validation folds for a time series dataset.
docstr_tok: ["Generate","train","and","validation","folds","for","a","time","series","dataset","."]
code: def split(
      self, data: TimeSeriesDataFrame
  ) -> Iterator[Tuple[TimeSeriesDataFrame, TimeSeriesDataFrame]]:
      """Generate train and validation folds for a time series dataset."""
      for window_idx in range(1, self.num_val_windows + 1):
          val_end = (
              -(self.num_val_windows - window_idx) * self.val_step_size
          )
          train_end = val_end - self.prediction_length
          if val_end == 0:
              val_end = None
          train_data = data.slice_by_timestep(None, train_end)
          val_data = data.slice_by_timestep(None, val_end)
          yield train_data, val_data
  
file_path: autogluon/timeseries/src/autogluon/timeseries/splitter.py
imports: from typing import Iterator, Optional, Tuple
  from .dataset.ts_dataframe import TimeSeriesDataFrame
label_desc: Use image node_id 2 for calling the ExpandingWindowSplitter obj's underlying member method code with example usage: obj.split(data) without return types