docstr: Automatically fit the model and search for the best hyper parameters.
  
  :param data: train data.
         data can be a tuple of ndarrays or a PyTorch DataLoader
         or a function that takes a config dictionary as parameter and returns a
         PyTorch DataLoader.
  :param epochs: Max number of epochs to train in each trial. Defaults to 1.
         If you have also set metric_threshold, a trial will stop if either it has been
         optimized to the metric_threshold or it has been trained for {epochs} epochs.
  :param batch_size: Int or hp sampling function from an integer space. Training batch size.
         It defaults to 32.
  :param validation_data: Validation data. Validation data type should be the same as data.
  :param metric_threshold: a trial will be terminated when metric threshold is met.
  :param n_sampling: Number of times to sample from the search_space. Defaults to 1.
         If hp.grid_search is in search_space, the grid will be repeated n_sampling of times.
         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","hyper","parameters",".",":","param","data",":","train","data",".","data","can","be","a","tuple","of","ndarrays","or","a","PyTorch","DataLoader","or","a","function","that","takes","a","config","dictionary","as","parameter","and","returns","a","PyTorch","DataLoader",".",":","param","epochs",":","Max","number","of","epochs","to","train","in","each","trial",".","Defaults","to","1",".","If","you","have","also","set","metric_threshold",",","a","trial","will","stop","if","either","it","has","been","optimized","to","the","metric_threshold","or","it","has","been","trained","for","{","epochs","}","epochs",".",":","param","batch_size",":","Int","or","hp","sampling","function","from","an","integer","space",".","Training","batch","size",".","It","defaults","to","32.",":","param","validation_data",":","Validation","data",".","Validation","data","type","should","be","the","same","as","data",".",":","param","metric_threshold",":","a","trial","will","be","terminated","when","metric","threshold","is","met",".",":","param","n_sampling",":","Number","of","times","to","sample","from","the","search_space",".","Defaults","to","1",".","If","hp.grid_search","is","in","search_space",",","the","grid","will","be","repeated","n_sampling","of","times",".","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,
      epochs=1,
      batch_size=32,
      validation_data=None,
      metric_threshold=None,
      n_sampling=1,
      search_alg=None,
      search_alg_params=None,
      scheduler=None,
      scheduler_params=None,
  ):
      """
      Automatically fit the model and search for the best hyper parameters.
  
      :param data: train data.
             data can be a tuple of ndarrays or a PyTorch DataLoader
             or a function that takes a config dictionary as parameter and returns a
             PyTorch DataLoader.
      :param epochs: Max number of epochs to train in each trial. Defaults to 1.
             If you have also set metric_threshold, a trial will stop if either it has been
             optimized to the metric_threshold or it has been trained for {epochs} epochs.
      :param batch_size: Int or hp sampling function from an integer space. Training batch size.
             It defaults to 32.
      :param validation_data: Validation data. Validation data type should be the same as data.
      :param metric_threshold: a trial will be terminated when metric threshold is met.
      :param n_sampling: Number of times to sample from the search_space. Defaults to 1.
             If hp.grid_search is in search_space, the grid will be repeated n_sampling of times.
             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.
      """
      self.search_space["batch_size"] = batch_size
      self.auto_est.fit(
          data=data,
          epochs=epochs,
          validation_data=validation_data,
          metric=self.metric,
          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,
      )
      self.best_model = self.auto_est._get_best_automl_model()
      self.best_config = self.auto_est.get_best_config()
  
file_path: analytics-zoo/pyzoo/zoo/chronos/autots/model/base_automodel.py
imports: import os
  import json
label_desc: Use image node_id 2 for calling the BasePytorchAutomodel obj's underlying member method code with example usage: obj.fit(data, epochs, batch_size, validation_data, metric_threshold, n_sampling, search_alg, search_alg_params, scheduler, scheduler_params) without return types