class_docstr: Forecaster base model for lstm, mtnet, seq2seq and tcn forecasters.
class_docstr_tok: ["Forecaster","base","model","for","lstm",",","mtnet",",","seq2seq","and","tcn","forecasters","."]
docstr: Fit(Train) the forecaster.
  
  :param data: The data support following formats:
  
         | 1. a numpy ndarray tuple (x, y):
         | x's shape is (num_samples, lookback, feature_dim) where lookback and feature_dim
         | should be the same as past_seq_len and input_feature_num.
         | y's shape is (num_samples, horizon, target_dim), where horizon and target_dim
         | should be the same as future_seq_len and output_feature_num.
         | 2. a xshard item:
         | each partition can be a dictionary of {'x': x, 'y': y}, where x and y's shape
         | should follow the shape stated before.
  
  :param epochs: Number of epochs you want to train. The value defaults to 1.
  :param batch_size: Number of batch size you want to train. The value defaults to 32.
  
  :return: Evaluation results on data.
docstr_tok: ["Fit","(","Train",")","the","forecaster",".",":","param","data",":","The","data","support","following","formats",":","|","1.","a","numpy","ndarray","tuple","(","x",",","y",")",":","|","x","'s","shape","is","(","num_samples",",","lookback",",","feature_dim",")","where","lookback","and","feature_dim","|","should","be","the","same","as","past_seq_len","and","input_feature_num",".","|","y","'s","shape","is","(","num_samples",",","horizon",",","target_dim",")",",","where","horizon","and","target_dim","|","should","be","the","same","as","future_seq_len","and","output_feature_num",".","|","2.","a","xshard","item",":","|","each","partition","can","be","a","dictionary","of","{","'","x","'",":","x",",","'","y","'",":","y","}",",","where","x","and","y","'s","shape","|","should","follow","the","shape","stated","before",".",":","param","epochs",":","Number","of","epochs","you","want","to","train",".","The","value","defaults","to","1.",":","param","batch_size",":","Number","of","batch","size","you","want","to","train",".","The","value","defaults","to","32.",":","return",":","Evaluation","results","on","data","."]
code: def fit(self, data, epochs=1, batch_size=32):
      # TODO: give an option to close validation during fit to save time.
      """
      Fit(Train) the forecaster.
  
      :param data: The data support following formats:
  
             | 1. a numpy ndarray tuple (x, y):
             | x's shape is (num_samples, lookback, feature_dim) where lookback and feature_dim
             | should be the same as past_seq_len and input_feature_num.
             | y's shape is (num_samples, horizon, target_dim), where horizon and target_dim
             | should be the same as future_seq_len and output_feature_num.
             | 2. a xshard item:
             | each partition can be a dictionary of {'x': x, 'y': y}, where x and y's shape
             | should follow the shape stated before.
  
      :param epochs: Number of epochs you want to train. The value defaults to 1.
      :param batch_size: Number of batch size you want to train. The value defaults to 32.
  
      :return: Evaluation results on data.
      """
  
      # input adaption
      self.config["batch_size"] = batch_size
  
      # input transform
      if isinstance(data, tuple) and self.distributed:
          data = np_to_creator(data)
      if isinstance(data, SparkXShards) and not self.distributed:
          data = xshard_to_np(data)
  
      # fit on internal
      if self.distributed:
          return self.internal.fit(
              data=data, epochs=epochs, batch_size=batch_size
          )
      else:
          check_data(data[0], data[1], self.data_config)
          return self.internal.fit_eval(
              data=data,
              validation_data=data,
              epochs=epochs,
              metric=self.metrics[0],  # only use the first metric
              **self.config,
          )
  
file_path: analytics-zoo/pyzoo/zoo/chronos/forecaster/base_forecaster.py
imports: from zoo.chronos.forecaster.abstract import Forecaster
  from zoo.orca.data.shard import SparkXShards
  from zoo.chronos.forecaster.utils import np_to_creator, set_pytorch_seed, check_data, xshard_to_np, np_to_xshard
  import numpy
  from zoo.orca.learn.pytorch.estimator import Estimator
  from zoo.orca.learn.metrics import MSE, MAE
label_desc: Use image node_id 2 for calling the BasePytorchForecaster obj's underlying member method code with example usage: obj.fit(data, epochs, batch_size) and returns: self, self