class_docstr: Class for the purpose of preprocessing time series.
  
  The method make_features needs to be custom-made by inherited classes.
class_docstr_tok: ["Class","for","the","purpose","of","preprocessing","time","series",".","The","method","make_features","needs","to","be","custom-made","by","inherited","classes","."]
docstr: Takes a single time series, ts_list, and returns preprocessed data.
  
  Note that the number of features is determined by the implementation
  of make_features. The number of context windows is determined by
  num_samples, see documentation under Parameters.
  
  If stratify_targets is False, then the length of feature_data is:
  (number of context windows) x (number of features)
  And the length of target_data is:
  (number of context windows) x (forecast_horizon)
  
  If stratify_targets is False, then the length of feature_data is:
  (number of context windows) * forecast_horizon x (number of features+1)
  And the length of target_data is:
  (number of context windows) * forecast_horizon x 1
  
  Parameters
  ----------
  time_series: dict
      has 'target' and 'start' keys
  
  Returns
  -------
  tuple
      list of feature datapoints, list of target datapoints
docstr_tok: ["Takes","a","single","time","series",",","ts_list",",","and","returns","preprocessed","data",".","Note","that","the","number","of","features","is","determined","by","the","implementation","of","make_features",".","The","number","of","context","windows","is","determined","by","num_samples",",","see","documentation","under","Parameters",".","If","stratify_targets","is","False",",","then","the","length","of","feature_data","is",":","(","number","of","context","windows",")","x","(","number","of","features",")","And","the","length","of","target_data","is",":","(","number","of","context","windows",")","x","(","forecast_horizon",")","If","stratify_targets","is","False",",","then","the","length","of","feature_data","is",":","(","number","of","context","windows",")","*","forecast_horizon","x","(","number","of","features+1",")","And","the","length","of","target_data","is",":","(","number","of","context","windows",")","*","forecast_horizon","x","1","Parameters","--","--","--","--","--","time_series",":","dict","has","'target","'","and","'start","'","keys","Returns","--","--","--","-","tuple","list","of","feature","datapoints",",","list","of","target","datapoints"]
code: def preprocess_from_single_ts(self, time_series: Dict) -> Tuple:
      """
      Takes a single time series, ts_list, and returns preprocessed data.
  
      Note that the number of features is determined by the implementation
      of make_features. The number of context windows is determined by
      num_samples, see documentation under Parameters.
  
      If stratify_targets is False, then the length of feature_data is:
      (number of context windows) x (number of features)
      And the length of target_data is:
      (number of context windows) x (forecast_horizon)
  
      If stratify_targets is False, then the length of feature_data is:
      (number of context windows) * forecast_horizon x (number of features+1)
      And the length of target_data is:
      (number of context windows) * forecast_horizon x 1
  
      Parameters
      ----------
      time_series: dict
          has 'target' and 'start' keys
  
      Returns
      -------
      tuple
          list of feature datapoints, list of target datapoints
      """
      altered_time_series = time_series.copy()
      if self.n_ignore_last > 0:
          altered_time_series["target"] = altered_time_series["target"][
              : -self.n_ignore_last
          ]
      feature_data = []
      target_data = []
      max_num_context_windows = (
          len(altered_time_series["target"])
          - self.context_window_size
          - self.forecast_horizon
          + 1
      )
      if max_num_context_windows < 1:
          return [[]], [[]]
  
      assert self.num_samples is not None
  
      if self.num_samples > 0:
          locations: Sequence[int] = [
              np.random.randint(max_num_context_windows)
              for _ in range(self.num_samples)
          ]
      else:
          locations = range(max_num_context_windows)
      for starting_index in locations:
          if self.stratify_targets:
              featurized_data = self.make_features(
                  altered_time_series, starting_index
              )
              for forecast_horizon_index in range(
                  self.forecast_horizon
              ):
                  feature_data.append(
                      list(featurized_data) + [forecast_horizon_index]
                  )
                  target_data.append(
                      [
                          time_series["target"][
                              starting_index
                              + self.context_window_size
                              + forecast_horizon_index
                          ]
                      ]
                  )
          else:
              featurized_data = self.make_features(
                  altered_time_series, starting_index
              )
              feature_data.append(featurized_data)
              target_data.append(
                  time_series["target"][
                      starting_index
                      + self.context_window_size : starting_index
                      + self.context_window_size
                      + self.forecast_horizon
                  ]
              )
      return feature_data, target_data
  
imports: import concurrent.futures
  import logging
  from enum import Enum
  from itertools import chain, starmap
  from typing import Dict, List, Tuple, Union, Optional, Sequence
  import numpy
  from gluonts.core.component import validated
label_desc: Use image node_id 3 for calling the PreprocessGeneric obj's underlying member method code with example usage: obj.preprocess_from_single_ts(time_series) and returns: feature_data,  target_data, list,  list