docstr: Initialize a BOHB search strategy optimizer
  BOHB performs robust and efficient hyperparameter optimization at scale by combining
  the speed of Hyperband searches with the guidance and guarantees of convergence of Bayesian
  Optimization. Instead of sampling new configurations at random,
  BOHB uses kernel density estimators to select promising candidates.
  
  .. note::
  
      For reference:
      @InProceedings{falkner-icml-18,
          title =        {{BOHB}: Robust and Efficient Hyperparameter Optimization at Scale},
          author =       {Falkner, Stefan and Klein, Aaron and Hutter, Frank},
          booktitle =    {Proceedings of the 35th International Conference on Machine Learning},
          pages =        {1436--1445},
          year =         {2018},
      }
  
  :param str base_task_id: Task ID (str)
  :param list hyper_parameters: list of Parameter objects to optimize over
  :param Objective objective_metric: Objective metric to maximize / minimize
  :param str execution_queue: execution queue to use for launching Tasks (experiments).
  :param int num_concurrent_workers: Limit number of concurrent running Tasks (machines)
  :param int min_iteration_per_job: minimum number of iterations for a job to run.
      'iterations' are the reported iterations for the specified objective,
      not the maximum reported iteration of the Task.
  :param int max_iteration_per_job: number of iteration per job
      'iterations' are the reported iterations for the specified objective,
      not the maximum reported iteration of the Task.
  :param int total_max_jobs: total maximum job for the optimization process.
      Must be provided in order to calculate the total budget for the optimization process.
      The total budget is measured by "iterations" (see above)
      and will be set to `max_iteration_per_job * total_max_jobs`
      This means more than total_max_jobs could be created, as long as the cumulative iterations
      (summed over all created jobs) will not exceed `max_iteration_per_job * total_max_jobs`
  :param float pool_period_min: time in minutes between two consecutive pools
  :param float time_limit_per_job: Optional, maximum execution time per single job in minutes,
      when time limit is exceeded job is aborted
  :param float compute_time_limit: The maximum compute time in minutes. When time limit is exceeded,
      all jobs aborted. (Optional)
  :param int local_port: default port 9090 tcp, this is a must for the BOHB workers to communicate, even locally.
  :param bohb_kwargs: arguments passed directly to the BOHB object
docstr_tok: ["Initialize","a","BOHB","search","strategy","optimizer","BOHB","performs","robust","and","efficient","hyperparameter","optimization","at","scale","by","combining","the","speed","of","Hyperband","searches","with","the","guidance","and","guarantees","of","convergence","of","Bayesian","Optimization",".","Instead","of","sampling","new","configurations","at","random",",","BOHB","uses","kernel","density","estimators","to","select","promising","candidates",".","..","note",":",":","For","reference",":","@","InProceedings","{","falkner-icml-18",",","title","=","{","{","BOHB","}",":","Robust","and","Efficient","Hyperparameter","Optimization","at","Scale","}",",","author","=","{","Falkner",",","Stefan","and","Klein",",","Aaron","and","Hutter",",","Frank","}",",","booktitle","=","{","Proceedings","of","the","35th","International","Conference","on","Machine","Learning","}",",","pages","=","{","1436","--","1445","}",",","year","=","{","2018","}",",","}",":","param","str","base_task_id",":","Task","ID","(","str",")",":","param","list","hyper_parameters",":","list","of","Parameter","objects","to","optimize","over",":","param","Objective","objective_metric",":","Objective","metric","to","maximize","\/","minimize",":","param","str","execution_queue",":","execution","queue","to","use","for","launching","Tasks","(","experiments",")",".",":","param","int","num_concurrent_workers",":","Limit","number","of","concurrent","running","Tasks","(","machines",")",":","param","int","min_iteration_per_job",":","minimum","number","of","iterations","for","a","job","to","run",".","'iterations","'","are","the","reported","iterations","for","the","specified","objective",",","not","the","maximum","reported","iteration","of","the","Task",".",":","param","int","max_iteration_per_job",":","number","of","iteration","per","job","'iterations","'","are","the","reported","iterations","for","the","specified","objective",",","not","the","maximum","reported","iteration","of","the","Task",".",":","param","int","total_max_jobs",":","total","maximum","job","for","the","optimization","process",".","Must","be","provided","in","order","to","calculate","the","total","budget","for","the","optimization","process",".","The","total","budget","is","measured","by","``","iterations","''","(","see","above",")","and","will","be","set","to","`","max_iteration_per_job","*","total_max_jobs","`","This","means","more","than","total_max_jobs","could","be","created",",","as","long","as","the","cumulative","iterations","(","summed","over","all","created","jobs",")","will","not","exceed","`","max_iteration_per_job","*","total_max_jobs","`",":","param","float","pool_period_min",":","time","in","minutes","between","two","consecutive","pools",":","param","float","time_limit_per_job",":","Optional",",","maximum","execution","time","per","single","job","in","minutes",",","when","time","limit","is","exceeded","job","is","aborted",":","param","float","compute_time_limit",":","The","maximum","compute","time","in","minutes",".","When","time","limit","is","exceeded",",","all","jobs","aborted",".","(","Optional",")",":","param","int","local_port",":","default","port","9090","tcp",",","this","is","a","must","for","the","BOHB","workers","to","communicate",",","even","locally",".",":","param","bohb_kwargs",":","arguments","passed","directly","to","the","BOHB","object"]
code: def __init__(
      self,
      base_task_id,  # type: str
      hyper_parameters,  # type: Sequence[Parameter]
      objective_metric,  # type: Objective
      execution_queue,  # type: str
      num_concurrent_workers,  # type: int
      min_iteration_per_job,  # type: Optional[int]
      max_iteration_per_job,  # type: Optional[int]
      total_max_jobs,  # type: Optional[int]
      pool_period_min=2.0,  # type: float
      time_limit_per_job=None,  # type: Optional[float]
      compute_time_limit=None,  # type: Optional[float]
      local_port=9090,  # type: int
      **bohb_kwargs,  # type: Any
  ):
      # type: (...) -> None
      """
      Initialize a BOHB search strategy optimizer
      BOHB performs robust and efficient hyperparameter optimization at scale by combining
      the speed of Hyperband searches with the guidance and guarantees of convergence of Bayesian
      Optimization. Instead of sampling new configurations at random,
      BOHB uses kernel density estimators to select promising candidates.
  
      .. note::
  
          For reference:
          @InProceedings{falkner-icml-18,
              title =        {{BOHB}: Robust and Efficient Hyperparameter Optimization at Scale},
              author =       {Falkner, Stefan and Klein, Aaron and Hutter, Frank},
              booktitle =    {Proceedings of the 35th International Conference on Machine Learning},
              pages =        {1436--1445},
              year =         {2018},
          }
  
      :param str base_task_id: Task ID (str)
      :param list hyper_parameters: list of Parameter objects to optimize over
      :param Objective objective_metric: Objective metric to maximize / minimize
      :param str execution_queue: execution queue to use for launching Tasks (experiments).
      :param int num_concurrent_workers: Limit number of concurrent running Tasks (machines)
      :param int min_iteration_per_job: minimum number of iterations for a job to run.
          'iterations' are the reported iterations for the specified objective,
          not the maximum reported iteration of the Task.
      :param int max_iteration_per_job: number of iteration per job
          'iterations' are the reported iterations for the specified objective,
          not the maximum reported iteration of the Task.
      :param int total_max_jobs: total maximum job for the optimization process.
          Must be provided in order to calculate the total budget for the optimization process.
          The total budget is measured by "iterations" (see above)
          and will be set to `max_iteration_per_job * total_max_jobs`
          This means more than total_max_jobs could be created, as long as the cumulative iterations
          (summed over all created jobs) will not exceed `max_iteration_per_job * total_max_jobs`
      :param float pool_period_min: time in minutes between two consecutive pools
      :param float time_limit_per_job: Optional, maximum execution time per single job in minutes,
          when time limit is exceeded job is aborted
      :param float compute_time_limit: The maximum compute time in minutes. When time limit is exceeded,
          all jobs aborted. (Optional)
      :param int local_port: default port 9090 tcp, this is a must for the BOHB workers to communicate, even locally.
      :param bohb_kwargs: arguments passed directly to the BOHB object
      """
      if (
          not max_iteration_per_job
          or not min_iteration_per_job
          or not total_max_jobs
      ):
          raise ValueError(
              "OptimizerBOHB is missing a defined budget.\n"
              "The following arguments must be defined: "
              "max_iteration_per_job, min_iteration_per_job, total_max_jobs.\n"
              "Maximum optimization budget is: max_iteration_per_job * total_max_jobs\n"
          )
  
      super(OptimizerBOHB, self).__init__(
          base_task_id=base_task_id,
          hyper_parameters=hyper_parameters,
          objective_metric=objective_metric,
          execution_queue=execution_queue,
          num_concurrent_workers=num_concurrent_workers,
          pool_period_min=pool_period_min,
          time_limit_per_job=time_limit_per_job,
          compute_time_limit=compute_time_limit,
          max_iteration_per_job=max_iteration_per_job,
          min_iteration_per_job=min_iteration_per_job,
          total_max_jobs=total_max_jobs,
      )
      self._max_iteration_per_job = max_iteration_per_job
      self._min_iteration_per_job = min_iteration_per_job
      verified_bohb_kwargs = [
          "eta",
          "min_budget",
          "max_budget",
          "min_points_in_model",
          "top_n_percent",
          "num_samples",
          "random_fraction",
          "bandwidth_factor",
          "min_bandwidth",
      ]
      self._bohb_kwargs = dict(
          (k, v)
          for k, v in bohb_kwargs.items()
          if k in verified_bohb_kwargs
      )
      self._param_iterator = None
      self._namespace = None
      self._bohb = None
      self._res = None
      self._nameserver_port = local_port
  
file_path: clearml/clearml/automation/hpbandster/bandster.py
imports: from time import sleep, time
  from typing import Any, Optional, Sequence
  from ..optimization import Objective, SearchStrategy
  from ..parameters import DiscreteParameterRange, UniformParameterRange, RandomSeed, UniformIntegerParameterRange, Parameter
  from ...task import Task
label_desc: Use image node_id 1 to create a new OptimizerBOHB object from inherited base classes: SearchStrategy, RandomSeed with example: obj = OptimizerBOHB(base_task_id, hyper_parameters, objective_metric, execution_queue, num_concurrent_workers, min_iteration_per_job, max_iteration_per_job, total_max_jobs, pool_period_min, time_limit_per_job, compute_time_limit, local_port)