class_docstr: Forecaster base model for lstm, seq2seq, tcn and nbeats forecasters.
class_docstr_tok: ["Forecaster","base","model","for","lstm",",","seq2seq",",","tcn","and","nbeats","forecasters","."]
docstr: Build a Forecaster Model.
  
  :param tsdataset: Train tsdataset, a bigdl.chronos.data.tsdataset.TSDataset instance.
  :param past_seq_len: int or "auto", Specify the history time steps (i.e. lookback).
         Do not specify the 'past_seq_len' if your tsdataset has called
         the 'TSDataset.roll' method or 'TSDataset.to_torch_data_loader'.
         If "auto", the mode of time series' cycle length will be taken as the past_seq_len.
  :param future_seq_len: int or list, Specify the output time steps (i.e. horizon).
         Do not specify the 'future_seq_len' if your tsdataset has called
         the 'TSDataset.roll' method or 'TSDataset.to_torch_data_loader'.
  :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: Train tsdataset, a bigdl.chronos.data.tsdataset.TSDataset instance.
      :param past_seq_len: int or "auto", Specify the history time steps (i.e. lookback).
             Do not specify the 'past_seq_len' if your tsdataset has called
             the 'TSDataset.roll' method or 'TSDataset.to_torch_data_loader'.
             If "auto", the mode of time series' cycle length will be taken as the past_seq_len.
      :param future_seq_len: int or list, Specify the output time steps (i.e. horizon).
             Do not specify the 'future_seq_len' if your tsdataset has called
             the 'TSDataset.roll' method or 'TSDataset.to_torch_data_loader'.
      :param kwargs: Specify parameters of Forecaster,
             e.g. loss and optimizer, etc.
             More info, please refer to Forecaster.__init__ methods.
  
      :return: A Forecaster Model.
      """
      invalidInputError(
          isinstance(tsdataset, TSDataset),
          f"We only supports input a TSDataset, but get{type(tsdataset)}.",
      )
  
      def check_time_steps(tsdataset, past_seq_len, future_seq_len):
          if (
              tsdataset.lookback is not None
              and past_seq_len is not None
          ):
              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 is not None
      ):  # calling roll or to_torch_data_loader
          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 is not None and future_seq_len is not None
      ):  # initialize only
          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 requires 'past_seq_len' and 'future_seq_len' to specify "
              "the history time step and output time step.",
          )
  
      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",
      )
  
      if tsdataset.id_sensitive:
          _id_list_len = len(tsdataset.id_col)
          input_feature_num *= _id_list_len
          output_feature_num *= _id_list_len
  
      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: from bigdl.chronos.forecaster.abstract import Forecaster
  from bigdl.chronos.forecaster.utils import *
  from bigdl.chronos.metric.forecast_metrics import Evaluator
  from typing import Optional
  import numpy
  import warnings
  import os
  from tempfile import TemporaryDirectory
  import torch
  from torch.utils.data import TensorDataset, DataLoader
  from .utils_hpo import GenericLightningModule, _format_metric_str, _config_has_search_space
  from bigdl.nano.utils.common import invalidOperationError, invalidInputError
  from bigdl.chronos.data.tsdataset import TSDataset
  from bigdl.chronos.pytorch.context_manager import DummyForecasterContextManager, ForecasterContextManager
  from bigdl.chronos.pytorch.utils import _pytorch_fashion_inference
label_desc: Use image node_id 26 for calling the BasePytorchForecaster 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