docstr: Trains the model for time sequence prediction.
  If future sequence length > 1, use seq2seq model, else use vanilla LSTM model.
  :param input_df: The input time series data frame, Example:
   datetime   value   "extra feature 1"   "extra feature 2"
   2019-01-01 1.9 1   2
   2019-01-02 2.3 0   2
  :param validation_df: validation data
  :param metric: String. Metric used for train and validation. Available values are
                 "mean_squared_error" or "r_square"
  :param recipe: a Recipe object. Various recipes covers different search space and stopping
                criteria. Default is SmokeRecipe().
  :param resources_per_trial: Machine resources to allocate per trial,
      e.g. ``{"cpu": 64, "gpu": 8}`
  :param upload_dir: Optional URI to sync training results and checkpoints. We only support
      hdfs URI for now. It defaults to
      "hdfs:///user/{hadoop_user_name}/ray_checkpoints/{predictor_name}".
      Where hadoop_user_name is specified in init_orca_context or init_spark_on_yarn,
      which defaults to "root". predictor_name is the name used in predictor instantiation.
  )
  :return: a pipeline constructed with the best model and configs.
docstr_tok: ["Trains","the","model","for","time","sequence","prediction",".","If","future","sequence","length",">","1",",","use","seq2seq","model",",","else","use","vanilla","LSTM","model",".",":","param","input_df",":","The","input","time","series","data","frame",",","Example",":","datetime","value","``","extra","feature","1","''","``","extra","feature","2","''","2019-01-01","1.9","1","2","2019-01-02","2.3","0","2",":","param","validation_df",":","validation","data",":","param","metric",":","String",".","Metric","used","for","train","and","validation",".","Available","values","are","``","mean_squared_error","''","or","``","r_square","''",":","param","recipe",":","a","Recipe","object",".","Various","recipes","covers","different","search","space","and","stopping","criteria",".","Default","is","SmokeRecipe","(",")",".",":","param","resources_per_trial",":","Machine","resources","to","allocate","per","trial",",","e.g",".","``","{","``","cpu","''",":","64",",","``","gpu","''",":","8","}","`",":","param","upload_dir",":","Optional","URI","to","sync","training","results","and","checkpoints",".","We","only","support","hdfs","URI","for","now",".","It","defaults","to","``","hdfs",":","\/\/\/user\/","{","hadoop_user_name","}","\/ray_checkpoints\/","{","predictor_name","}","''",".","Where","hadoop_user_name","is","specified","in","init_orca_context","or","init_spark_on_yarn",",","which","defaults","to","``","root","''",".","predictor_name","is","the","name","used","in","predictor","instantiation.",")",":","return",":","a","pipeline","constructed","with","the","best","model","and","configs","."]
code: def fit(
      self,
      input_df,
      validation_df=None,
      metric="mse",
      recipe=SmokeRecipe(),
      mc=False,
      resources_per_trial={"cpu": 2},
      upload_dir=None,
  ):
      """
      Trains the model for time sequence prediction.
      If future sequence length > 1, use seq2seq model, else use vanilla LSTM model.
      :param input_df: The input time series data frame, Example:
       datetime   value   "extra feature 1"   "extra feature 2"
       2019-01-01 1.9 1   2
       2019-01-02 2.3 0   2
      :param validation_df: validation data
      :param metric: String. Metric used for train and validation. Available values are
                     "mean_squared_error" or "r_square"
      :param recipe: a Recipe object. Various recipes covers different search space and stopping
                    criteria. Default is SmokeRecipe().
      :param resources_per_trial: Machine resources to allocate per trial,
          e.g. ``{"cpu": 64, "gpu": 8}`
      :param upload_dir: Optional URI to sync training results and checkpoints. We only support
          hdfs URI for now. It defaults to
          "hdfs:///user/{hadoop_user_name}/ray_checkpoints/{predictor_name}".
          Where hadoop_user_name is specified in init_orca_context or init_spark_on_yarn,
          which defaults to "root". predictor_name is the name used in predictor instantiation.
      )
      :return: a pipeline constructed with the best model and configs.
      """
      self._check_df(input_df)
      if validation_df is not None:
          self._check_df(validation_df)
  
      ray_ctx = RayContext.get()
      is_local = ray_ctx.is_local
      # BasePredictor._check_fit_metric(metric)
      if not is_local:
          if not upload_dir:
              hadoop_user_name = os.getenv("HADOOP_USER_NAME")
              upload_dir = os.path.join(
                  os.sep,
                  "user",
                  hadoop_user_name,
                  "ray_checkpoints",
                  self.name,
              )
          cmd = "hadoop fs -mkdir -p {}".format(upload_dir)
          process(cmd)
      else:
          upload_dir = None
  
      self.pipeline = self._hp_search(
          input_df,
          validation_df=validation_df,
          metric=metric,
          recipe=recipe,
          mc=mc,
          resources_per_trial=resources_per_trial,
          remote_dir=upload_dir,
      )
      return self.pipeline
  
file_path: analytics-zoo/pyzoo/zoo/chronos/autots/deprecated/regression/base_predictor.py
imports: import pandas
  import os
  from abc import abstractmethod
  from zoo.orca.automl.metrics import Evaluator
  from zoo.chronos.autots.deprecated.pipeline.time_sequence import TimeSequencePipeline
  from zoo.orca.automl.search.utils import process
  from zoo.chronos.autots.deprecated.config.recipe import *
  from zoo.ray import RayContext
  from zoo.orca.automl.auto_estimator import AutoEstimator
label_desc: Use image node_id 5 for calling the BasePredictor obj's underlying member method code with example usage: obj.fit(input_df, validation_df, metric, recipe, mc, resources_per_trial, upload_dir) and returns: self