docstr: Build a Forecaster Model
  
  :param tsdataset: A bigdl.chronos.data.tsdataset.TSDataset instance.
  :param past_seq_len:  Specify history time step (i.e. lookback)
         Do not specify the 'past_seq_len' if your tsdataset has called
         the 'TSDataset.roll' method or 'TSDataset.to_tf_dataset'.
  :param future_seq_len: Specify output time step (i.e. horizon)
         Do not specify the 'future_seq_len' if your tsdataset has called
         the 'TSDataset.roll' method or 'TSDataset.to_tf_dataset'.
  :param kwargs: Specify parameters of Forecaster,
         e.g. loss and optimizer, etc.
         More info, please refer to Forecaster.__init__ methods.
  
  :return: A Forecaster Model
docstr_tok: ["Build","a","Forecaster","Model",":","param","tsdataset",":","A","bigdl.chronos.data.tsdataset.TSDataset","instance",".",":","param","past_seq_len",":","Specify","history","time","step","(","i.e",".","lookback",")","Do","not","specify","the","'past_seq_len","'","if","your","tsdataset","has","called","the","'TSDataset.roll","'","method","or","'TSDataset.to_tf_dataset","'",".",":","param","future_seq_len",":","Specify","output","time","step","(","i.e",".","horizon",")","Do","not","specify","the","'future_seq_len","'","if","your","tsdataset","has","called","the","'TSDataset.roll","'","method","or","'TSDataset.to_tf_dataset","'",".",":","param","kwargs",":","Specify","parameters","of","Forecaster",",","e.g",".","loss","and","optimizer",",","etc",".","More","info",",","please","refer","to","Forecaster.__init__","methods",".",":","return",":","A","Forecaster","Model"]
code: def from_tsdataset(
      cls, tsdataset, past_seq_len=None, future_seq_len=None, **kwargs
  ):
      """
      Build a Forecaster Model
  
      :param tsdataset: A bigdl.chronos.data.tsdataset.TSDataset instance.
      :param past_seq_len:  Specify history time step (i.e. lookback)
             Do not specify the 'past_seq_len' if your tsdataset has called
             the 'TSDataset.roll' method or 'TSDataset.to_tf_dataset'.
      :param future_seq_len: Specify output time step (i.e. horizon)
             Do not specify the 'future_seq_len' if your tsdataset has called
             the 'TSDataset.roll' method or 'TSDataset.to_tf_dataset'.
      :param kwargs: Specify parameters of Forecaster,
             e.g. loss and optimizer, etc.
             More info, please refer to Forecaster.__init__ methods.
  
      :return: A Forecaster Model
      """
  
      def check_time_steps(tsdataset, past_seq_len, future_seq_len):
          if tsdataset.lookback and past_seq_len:
              future_seq_len = (
                  future_seq_len
                  if isinstance(future_seq_len, int)
                  else max(future_seq_len)
              )
              return (
                  tsdataset.lookback == past_seq_len
                  and tsdataset.horizon == future_seq_len
              )
          return True
  
      invalidInputError(
          not tsdataset._has_generate_agg_feature,
          "We will add support for 'gen_rolling_feature' method later.",
      )
  
      if tsdataset.lookback:
          past_seq_len = tsdataset.lookback
          future_seq_len = (
              tsdataset.horizon
              if isinstance(tsdataset.horizon, int)
              else max(tsdataset.horizon)
          )
          output_feature_num = len(tsdataset.roll_target)
          input_feature_num = (
              len(tsdataset.roll_feature) + output_feature_num
          )
      elif past_seq_len and future_seq_len:
          past_seq_len = (
              past_seq_len
              if isinstance(past_seq_len, int)
              else tsdataset.get_cycle_length()
          )
          future_seq_len = (
              future_seq_len
              if isinstance(future_seq_len, int)
              else max(future_seq_len)
          )
          output_feature_num = len(tsdataset.target_col)
          input_feature_num = (
              len(tsdataset.feature_col) + output_feature_num
          )
      else:
          invalidInputError(
              False,
              "Forecaster needs 'past_seq_len' and 'future_seq_len' "
              "to specify the history time step of training.",
          )
  
      invalidInputError(
          check_time_steps(tsdataset, past_seq_len, future_seq_len),
          "tsdataset already has history time steps and "
          "differs from the given past_seq_len and future_seq_len "
          "Expected past_seq_len and future_seq_len to be "
          f"{tsdataset.lookback, tsdataset.horizon}, "
          f"but found {past_seq_len, future_seq_len}.",
          fixMsg="Do not specify past_seq_len and future seq_len "
          "or call tsdataset.roll method again and specify time step",
      )
  
      return cls(
          past_seq_len=past_seq_len,
          future_seq_len=future_seq_len,
          input_feature_num=input_feature_num,
          output_feature_num=output_feature_num,
          **kwargs,
      )
  
imports: import warnings
  import keras
  import tensorflow
  import numpy
  from bigdl.chronos.forecaster.abstract import Forecaster
  from bigdl.chronos.data import TSDataset
  from bigdl.chronos.metric.forecast_metrics import Evaluator
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.chronos.forecaster.tf.utils import np_to_data_creator, tsdata_to_data_creator, np_to_xshards, xshard_to_np, np_to_tfdataset
label_desc: Use image node_id 10 for calling the BaseTF2Forecaster obj's underlying member method code with example usage: obj.from_tsdataset(cls, tsdataset, past_seq_len, future_seq_len) and returns: cls, True, unknown