class_docstr: Tabular Model Tuner.
  
  This class is used to tune the hyperparameters of a TabularModel, given the search space,  strategy and metric to
  optimize.
class_docstr_tok: ["Tabular","Model","Tuner",".","This","class","is","used","to","tune","the","hyperparameters","of","a","TabularModel",",","given","the","search","space",",","strategy","and","metric","to","optimize","."]
docstr: Tabular Model Tuner helps you tune the hyperparameters of a TabularModel.
  
  Args:
      data_config (Optional[Union[DataConfig, str]], optional): The DataConfig for the TabularModel.
          If str is passed, will initialize the DataConfig using the yaml file in that path.
          Defaults to None.
  
      model_config (Optional[Union[ModelConfig, str]], optional): The ModelConfig for the TabularModel.
          If str is passed, will initialize the ModelConfig using the yaml file in that path.
          Defaults to None.
  
      optimizer_config (Optional[Union[OptimizerConfig, str]], optional): The OptimizerConfig for the
          TabularModel. If str is passed, will initialize the OptimizerConfig using the yaml file in
          that path. Defaults to None.
  
      trainer_config (Optional[Union[TrainerConfig, str]], optional): The TrainerConfig for the TabularModel.
          If str is passed, will initialize the TrainerConfig using the yaml file in that path.
          Defaults to None.
  
      model_callable (Optional[Callable], optional): A callable that returns a PyTorch Tabular Model.
          If provided, will ignore the model_config and use this callable to initialize the model.
          Defaults to None.
  
      model_state_dict_path (Optional[Union[str, Path]], optional): Path to the state dict of the model.
  
          If provided, will ignore the model_config and use this state dict to initialize the model.
          Defaults to None.
  
      suppress_lightning_logger (bool, optional): Whether to suppress the lightning logger. Defaults to True.
  
      **kwargs: Additional keyword arguments to be passed to the TabularModel init.
docstr_tok: ["Tabular","Model","Tuner","helps","you","tune","the","hyperparameters","of","a","TabularModel",".","Args",":","data_config","(","Optional","[","Union","[","DataConfig",",","str","]","]",",","optional",")",":","The","DataConfig","for","the","TabularModel",".","If","str","is","passed",",","will","initialize","the","DataConfig","using","the","yaml","file","in","that","path",".","Defaults","to","None",".","model_config","(","Optional","[","Union","[","ModelConfig",",","str","]","]",",","optional",")",":","The","ModelConfig","for","the","TabularModel",".","If","str","is","passed",",","will","initialize","the","ModelConfig","using","the","yaml","file","in","that","path",".","Defaults","to","None",".","optimizer_config","(","Optional","[","Union","[","OptimizerConfig",",","str","]","]",",","optional",")",":","The","OptimizerConfig","for","the","TabularModel",".","If","str","is","passed",",","will","initialize","the","OptimizerConfig","using","the","yaml","file","in","that","path",".","Defaults","to","None",".","trainer_config","(","Optional","[","Union","[","TrainerConfig",",","str","]","]",",","optional",")",":","The","TrainerConfig","for","the","TabularModel",".","If","str","is","passed",",","will","initialize","the","TrainerConfig","using","the","yaml","file","in","that","path",".","Defaults","to","None",".","model_callable","(","Optional","[","Callable","]",",","optional",")",":","A","callable","that","returns","a","PyTorch","Tabular","Model",".","If","provided",",","will","ignore","the","model_config","and","use","this","callable","to","initialize","the","model",".","Defaults","to","None",".","model_state_dict_path","(","Optional","[","Union","[","str",",","Path","]","]",",","optional",")",":","Path","to","the","state","dict","of","the","model",".","If","provided",",","will","ignore","the","model_config","and","use","this","state","dict","to","initialize","the","model",".","Defaults","to","None",".","suppress_lightning_logger","(","bool",",","optional",")",":","Whether","to","suppress","the","lightning","logger",".","Defaults","to","True",".","*","*","kwargs",":","Additional","keyword","arguments","to","be","passed","to","the","TabularModel","init","."]
code: def __init__(
      self,
      data_config: Optional[Union[DataConfig, str]] = None,
      model_config: Optional[Union[ModelConfig, str]] = None,
      optimizer_config: Optional[Union[OptimizerConfig, str]] = None,
      trainer_config: Optional[Union[TrainerConfig, str]] = None,
      model_callable: Optional[Callable] = None,
      model_state_dict_path: Optional[Union[str, Path]] = None,
      suppress_lightning_logger: bool = True,
      **kwargs,
  ):
      """Tabular Model Tuner helps you tune the hyperparameters of a TabularModel.
  
      Args:
          data_config (Optional[Union[DataConfig, str]], optional): The DataConfig for the TabularModel.
              If str is passed, will initialize the DataConfig using the yaml file in that path.
              Defaults to None.
  
          model_config (Optional[Union[ModelConfig, str]], optional): The ModelConfig for the TabularModel.
              If str is passed, will initialize the ModelConfig using the yaml file in that path.
              Defaults to None.
  
          optimizer_config (Optional[Union[OptimizerConfig, str]], optional): The OptimizerConfig for the
              TabularModel. If str is passed, will initialize the OptimizerConfig using the yaml file in
              that path. Defaults to None.
  
          trainer_config (Optional[Union[TrainerConfig, str]], optional): The TrainerConfig for the TabularModel.
              If str is passed, will initialize the TrainerConfig using the yaml file in that path.
              Defaults to None.
  
          model_callable (Optional[Callable], optional): A callable that returns a PyTorch Tabular Model.
              If provided, will ignore the model_config and use this callable to initialize the model.
              Defaults to None.
  
          model_state_dict_path (Optional[Union[str, Path]], optional): Path to the state dict of the model.
  
              If provided, will ignore the model_config and use this state dict to initialize the model.
              Defaults to None.
  
          suppress_lightning_logger (bool, optional): Whether to suppress the lightning logger. Defaults to True.
  
          **kwargs: Additional keyword arguments to be passed to the TabularModel init.
      """
      if trainer_config.profiler is not None:
          warnings.warn(
              "Profiler is not supported in tuner. Set profiler=None in TrainerConfig to disable this warning."
          )
          trainer_config.profiler = None
      if trainer_config.fast_dev_run:
          warnings.warn(
              "fast_dev_run is turned on. Tuning results won't be accurate."
          )
      if trainer_config.progress_bar != "none":
          # If config and tuner have progress bar enabled, it will result in a bug within the library (rich.progress)
          trainer_config.progress_bar = "none"
          warnings.warn(
              "Turning off progress bar. Set progress_bar='none' in TrainerConfig to disable this warning."
          )
      trainer_config.trainer_kwargs.update(
          {"enable_model_summary": False}
      )
      self.data_config = data_config
      self.model_config = model_config
      self.optimizer_config = optimizer_config
      self.trainer_config = trainer_config
      self.suppress_lightning_logger = suppress_lightning_logger
      self.tabular_model_init_kwargs = {
          "model_callable": model_callable,
          "model_state_dict_path": model_state_dict_path,
          **kwargs,
      }
  
file_path: pytorch_tabular/src/pytorch_tabular/tabular_model_tuner.py
imports: import warnings
  from collections import namedtuple
  from copy import deepcopy
  from pathlib import Path
  from typing import Callable, Dict, Iterable, Optional, Union
  import numpy
  import pandas
  from omegaconf.dictconfig import DictConfig
  from pandas import DataFrame
  from rich.progress import track
  from sklearn.model_selection import BaseCrossValidator, ParameterGrid, ParameterSampler
  from pytorch_tabular.config import DataConfig, ModelConfig, OptimizerConfig, TrainerConfig
  from pytorch_tabular.tabular_model import TabularModel
  from pytorch_tabular.utils import OOMException, OutOfMemoryHandler, get_logger, suppress_lightning_logs
label_desc: Use image node_id 1 to create a new TabularModelTuner object  with example: obj = TabularModelTuner(data_config, model_config, optimizer_config, trainer_config, model_callable, model_state_dict_path, suppress_lightning_logger)