docstr: Automatically fit the model and search for the best hyperparameters.
  
  :param data: training data, a pandas dataframe with Td rows,
         and 2 columns, with column 'ds' indicating date and column 'y' indicating value
         and Td is the time dimension
  :param cross_validation: bool, if the eval result comes from cross_validation.
         The value is set to True by default. Setting this option to False to
         speed up the process.
  :param expect_horizon: int, validation data will be automatically splited from training
         data, and expect_horizon is the horizon you may need to use once the mode is fitted.
         The value defaults to None, where 10% of training data will be taken
         as the validation data.
  :param freq: the freqency of the training dataframe. the frequency can be anything from the
         pandas list of frequency strings here:
         https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#timeseries-offset-aliasesDefaulted
         to None, where an unreliable frequency will be infer implicitly.
  :param metric_threshold: a trial will be terminated when metric threshold is met
  :param n_sampling: Number of trials to evaluate in total. Defaults to 16.
         If hp.grid_search is in search_space, the grid will be run n_sampling of trials
         and round up n_sampling according to hp.grid_search.
         If this is -1, (virtually) infinite samples are generated
         until a stopping condition is met.
  :param search_alg: str, all supported searcher provided by ray tune
         (i.e."variant_generator", "random", "ax", "dragonfly", "skopt",
         "hyperopt", "bayesopt", "bohb", "nevergrad", "optuna", "zoopt" and
         "sigopt")
  :param search_alg_params: extra parameters for searcher algorithm besides search_space,
         metric and searcher mode
  :param scheduler: str, all supported scheduler provided by ray tune
  :param scheduler_params: parameters for scheduler
docstr_tok: ["Automatically","fit","the","model","and","search","for","the","best","hyperparameters",".",":","param","data",":","training","data",",","a","pandas","dataframe","with","Td","rows",",","and","2","columns",",","with","column","'ds","'","indicating","date","and","column","'","y","'","indicating","value","and","Td","is","the","time","dimension",":","param","cross_validation",":","bool",",","if","the","eval","result","comes","from","cross_validation",".","The","value","is","set","to","True","by","default",".","Setting","this","option","to","False","to","speed","up","the","process",".",":","param","expect_horizon",":","int",",","validation","data","will","be","automatically","splited","from","training","data",",","and","expect_horizon","is","the","horizon","you","may","need","to","use","once","the","mode","is","fitted",".","The","value","defaults","to","None",",","where","10","%","of","training","data","will","be","taken","as","the","validation","data",".",":","param","freq",":","the","freqency","of","the","training","dataframe",".","the","frequency","can","be","anything","from","the","pandas","list","of","frequency","strings","here",":","https",":","\/\/pandas.pydata.org\/pandas-docs\/stable\/user_guide\/timeseries.html","#","timeseries-offset-aliasesDefaulted","to","None",",","where","an","unreliable","frequency","will","be","infer","implicitly",".",":","param","metric_threshold",":","a","trial","will","be","terminated","when","metric","threshold","is","met",":","param","n_sampling",":","Number","of","trials","to","evaluate","in","total",".","Defaults","to","16",".","If","hp.grid_search","is","in","search_space",",","the","grid","will","be","run","n_sampling","of","trials","and","round","up","n_sampling","according","to","hp.grid_search",".","If","this","is","-1",",","(","virtually",")","infinite","samples","are","generated","until","a","stopping","condition","is","met",".",":","param","search_alg",":","str",",","all","supported","searcher","provided","by","ray","tune","(","i.e",".","``","variant_generator","''",",","``","random","''",",","``","ax","''",",","``","dragonfly","''",",","``","skopt","''",",","``","hyperopt","''",",","``","bayesopt","''",",","``","bohb","''",",","``","nevergrad","''",",","``","optuna","''",",","``","zoopt","''","and","``","sigopt","''",")",":","param","search_alg_params",":","extra","parameters","for","searcher","algorithm","besides","search_space",",","metric","and","searcher","mode",":","param","scheduler",":","str",",","all","supported","scheduler","provided","by","ray","tune",":","param","scheduler_params",":","parameters","for","scheduler"]
code: def fit(
      self,
      data,
      cross_validation=True,
      expect_horizon=None,
      freq=None,
      metric_threshold=None,
      n_sampling=16,
      search_alg=None,
      search_alg_params=None,
      scheduler=None,
      scheduler_params=None,
  ):
      """
      Automatically fit the model and search for the best hyperparameters.
  
      :param data: training data, a pandas dataframe with Td rows,
             and 2 columns, with column 'ds' indicating date and column 'y' indicating value
             and Td is the time dimension
      :param cross_validation: bool, if the eval result comes from cross_validation.
             The value is set to True by default. Setting this option to False to
             speed up the process.
      :param expect_horizon: int, validation data will be automatically splited from training
             data, and expect_horizon is the horizon you may need to use once the mode is fitted.
             The value defaults to None, where 10% of training data will be taken
             as the validation data.
      :param freq: the freqency of the training dataframe. the frequency can be anything from the
             pandas list of frequency strings here:
             https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#timeseries-offset-aliasesDefaulted
             to None, where an unreliable frequency will be infer implicitly.
      :param metric_threshold: a trial will be terminated when metric threshold is met
      :param n_sampling: Number of trials to evaluate in total. Defaults to 16.
             If hp.grid_search is in search_space, the grid will be run n_sampling of trials
             and round up n_sampling according to hp.grid_search.
             If this is -1, (virtually) infinite samples are generated
             until a stopping condition is met.
      :param search_alg: str, all supported searcher provided by ray tune
             (i.e."variant_generator", "random", "ax", "dragonfly", "skopt",
             "hyperopt", "bayesopt", "bohb", "nevergrad", "optuna", "zoopt" and
             "sigopt")
      :param search_alg_params: extra parameters for searcher algorithm besides search_space,
             metric and searcher mode
      :param scheduler: str, all supported scheduler provided by ray tune
      :param scheduler_params: parameters for scheduler
      """
      from bigdl.nano.utils.common import invalidInputError
  
      if expect_horizon is None:
          expect_horizon = int(0.1 * len(data))
      if freq is None:
          invalidInputError(
              len(data) >= 2,
              "The training dataframe should contains more than 2 records.",
          )
          invalidInputError(
              pd.api.types.is_datetime64_any_dtype(data["ds"].dtypes),
              "The 'ds' col should be in datetime 64 type,"
              " or you need to set `freq` in fit.",
          )
          self._freq = data["ds"].iloc[1] - data["ds"].iloc[0]
      else:
          self._freq = pd.Timedelta(freq)
      expect_horizon_str = str(self._freq * expect_horizon)
      self.search_space.update(
          {
              "expect_horizon": expect_horizon_str,
              "cross_validation": cross_validation,
          }
      )
      train_data = (
          data
          if cross_validation
          else data[: len(data) - expect_horizon]
      )
      validation_data = (
          None
          if cross_validation
          else data[len(data) - expect_horizon :]
      )
      n_sampling = (
          recalculate_n_sampling(self.search_space, n_sampling)
          if n_sampling != -1
          else -1
      )
      self.auto_est.fit(
          data=train_data,
          validation_data=validation_data,
          metric=self.metric,
          metric_mode=self.metric_mode,
          metric_threshold=metric_threshold,
          n_sampling=n_sampling,
          search_space=self.search_space,
          search_alg=search_alg,
          search_alg_params=search_alg_params,
          scheduler=scheduler,
          scheduler_params=scheduler_params,
      )
      # use the best config to fit a new prophet model on whole data
      self.best_model = ProphetBuilder().build(
          self.auto_est.get_best_config()
      )
      self.best_model.model.fit(data)
  
file_path: BigDL/python/chronos/src/bigdl/chronos/autots/model/auto_prophet.py
imports: import pandas
  import warnings
  from bigdl.chronos.model.prophet import ProphetBuilder, ProphetModel
  from bigdl.chronos.autots.utils import recalculate_n_sampling
label_desc: Use image node_id 2 for calling the AutoProphet obj's underlying member method code with example usage: obj.fit(data, cross_validation, expect_horizon, freq, metric_threshold, n_sampling, search_alg, search_alg_params, scheduler, scheduler_params) without return types