class_docstr: Automated TimeSeries Estimator for time series forecasting task, which supports
  TSDataset and customized data creator as data input on built-in model (only
  "lstm", "tcn", "seq2seq" for now) or 3rd party model.
  
  >>> # Here is a use case example:
  >>> # prepare train/valid/test tsdataset
  >>> autoest = AutoTSEstimator(model="lstm",
  >>>                           search_space=search_space,
  >>>                           past_seq_len=6,
  >>>                           future_seq_len=1)
  >>> tsppl = autoest.fit(data=tsdata_train,
  >>>                     validation_data=tsdata_valid)
  >>> tsppl.predict(tsdata_test)
  >>> tsppl.save("my_tsppl")
class_docstr_tok: ["Automated","TimeSeries","Estimator","for","time","series","forecasting","task",",","which","supports","TSDataset","and","customized","data","creator","as","data","input","on","built-in","model","(","only","''","lstm","''",",","``","tcn","''",",","``","seq2seq","''","for","now",")","or","3rd","party","model",".",">",">",">","#","Here","is","a","use","case","example",":",">",">",">","#","prepare","train\/valid\/test","tsdataset",">",">",">","autoest","=","AutoTSEstimator","(","model=","''","lstm","''",",",">",">",">","search_space=search_space",",",">",">",">","past_seq_len=6",",",">",">",">","future_seq_len=1",")",">",">",">","tsppl","=","autoest.fit","(","data=tsdata_train",",",">",">",">","validation_data=tsdata_valid",")",">",">",">","tsppl.predict","(","tsdata_test",")",">",">",">","tsppl.save","(","``","my_tsppl","''",")"]
docstr: prepare the data creators and add selected features to search_space
  :param search_space: the search space
  :param train_data: train data
  :param val_data: validation data
  :return: data creators from train and validation data
docstr_tok: ["prepare","the","data","creators","and","add","selected","features","to","search_space",":","param","search_space",":","the","search","space",":","param","train_data",":","train","data",":","param","val_data",":","validation","data",":","return",":","data","creators","from","train","and","validation","data"]
code: def _prepare_data_creator(
      self, search_space, train_data, val_data=None
  ):
      """
      prepare the data creators and add selected features to search_space
      :param search_space: the search space
      :param train_data: train data
      :param val_data: validation data
      :return: data creators from train and validation data
      """
      import ray
      from bigdl.nano.utils.common import invalidInputError
  
      # automatically inference output_feature_num
      # input_feature_num will be set by base pytorch model according to selected features.
      search_space["output_feature_num"] = len(train_data.target_col)
      if search_space["past_seq_len"] == "auto":
          cycle_length = train_data.get_cycle_length(
              aggregate="mode", top_k=3
          )
          cycle_length = 2 if cycle_length < 2 else cycle_length
          search_space["past_seq_len"] = hp.randint(
              cycle_length // 2, cycle_length * 2
          )
  
      # append feature selection into search space
      # TODO: more flexible setting
      all_features = train_data.feature_col
      if self.selected_features not in ("all", "auto"):
          invalidInputError(
              False,
              "Only 'all' and 'auto' are supported for selected_features, "
              f"but found {self.selected_features}",
          )
      if self.selected_features == "auto":
          if len(all_features) == 0:
              search_space["selected_features"] = all_features
          else:
              search_space["selected_features"] = hp.choice_n(
                  all_features, min_items=0, max_items=len(all_features)
              )
      if self.selected_features == "all":
          search_space["selected_features"] = all_features
  
      # put train/val data in ray
      train_data_id = ray.put(train_data)
      valid_data_id = ray.put(val_data)
  
      if self.backend == "torch":
          import torch
          from torch.utils.data import TensorDataset, DataLoader
  
          def train_data_creator(config):
              train_d = ray.get(train_data_id)
  
              x, y = train_d.roll(
                  lookback=config.get("past_seq_len"),
                  horizon=self._future_seq_len,
                  feature_col=config["selected_features"],
              ).to_numpy()
  
              return DataLoader(
                  TensorDataset(
                      torch.from_numpy(x).float(),
                      torch.from_numpy(y).float(),
                  ),
                  batch_size=config["batch_size"],
                  shuffle=True,
              )
  
          def val_data_creator(config):
              val_d = ray.get(valid_data_id)
  
              x, y = val_d.roll(
                  lookback=config.get("past_seq_len"),
                  horizon=self._future_seq_len,
                  feature_col=config["selected_features"],
              ).to_numpy()
  
              return DataLoader(
                  TensorDataset(
                      torch.from_numpy(x).float(),
                      torch.from_numpy(y).float(),
                  ),
                  batch_size=config["batch_size"],
                  shuffle=True,
              )
  
          return train_data_creator, val_data_creator
  
      if self.backend == "keras":
  
          def train_data_creator(config):
              train_d = ray.get(train_data_id)
  
              train_d.roll(
                  lookback=config.get("past_seq_len"),
                  horizon=self._future_seq_len,
                  feature_col=config["selected_features"],
              )
  
              return train_d.to_tf_dataset(
                  batch_size=config["batch_size"], shuffle=True
              )
  
          def val_data_creator(config):
              val_d = ray.get(valid_data_id)
  
              val_d.roll(
                  lookback=config.get("past_seq_len"),
                  horizon=self._future_seq_len,
                  feature_col=config["selected_features"],
              )
  
              return val_d.to_tf_dataset(
                  batch_size=config["batch_size"], shuffle=False
              )
  
          return train_data_creator, val_data_creator
  
file_path: BigDL/python/chronos/src/bigdl/chronos/autots/autotsestimator.py
imports: import types
  from bigdl.orca.automl.auto_estimator import AutoEstimator
  from bigdl.chronos.data import TSDataset
  import bigdl.orca.automl.hp
  from bigdl.chronos.autots.model import AutoModelFactory
  from bigdl.chronos.autots.utils import recalculate_n_sampling
label_desc: Use image node_id 3 for calling the AutoTSEstimator obj's underlying member method code with example usage: obj._prepare_data_creator(search_space, train_data, val_data) and returns: train_data_creator,  val_data_creator, train_data_creator,  val_data_creator, DataLoader, DataLoader, train_d, val_d