class_docstr: Uses fmfn/BayesianOptimization to optimize hyperparameters.
  
  fmfn/BayesianOptimization is a library for Bayesian Optimization. More
  info can be found here: https://github.com/fmfn/BayesianOptimization.
  
  This searcher will automatically filter out any NaN, inf or -inf
  results.
  
  You will need to install fmfn/BayesianOptimization via the following:
  
  .. code-block:: bash
  
      pip install bayesian-optimization
  
  Initializing this search algorithm with a ``space`` requires that it's
  in the ``BayesianOptimization`` search space format. Otherwise, you
  should instead pass in a Tune search space into ``Tuner(param_space=...)``,
  and the search space will be automatically converted for you.
  
  See this `BayesianOptimization example notebook
  <https://github.com/fmfn/BayesianOptimization/blob/master/examples/advanced-tour.ipynb>`_
  for an example.
  
  Args:
      space: Continuous search space. Parameters will be sampled from
          this space which will be used to run trials.
      metric: The training result objective value attribute. If None
          but a mode was passed, the anonymous metric `_metric` will be used
          per default.
      mode: One of {min, max}. Determines whether objective is
          minimizing or maximizing the metric attribute.
      points_to_evaluate: Initial parameter suggestions to be run
          first. This is for when you already have some good parameters
          you want to run first to help the algorithm make better suggestions
          for future parameters. Needs to be a list of dicts containing the
          configurations.
      utility_kwargs: Parameters to define the utility function.
          The default value is a dictionary with three keys:
          - kind: ucb (Upper Confidence Bound)
          - kappa: 2.576
          - xi: 0.0
      random_state: Used to initialize BayesOpt.
      random_search_steps: Number of initial random searches.
          This is necessary to avoid initial local overfitting
          of the Bayesian process.
      verbose: Sets verbosity level for BayesOpt packages.
      patience: If patience is set and we've repeated a trial numerous times,
          we terminate the experiment.
      skip_duplicate: skip duplicate config
      analysis: Optionally, the previous analysis to integrate.
  
  Tune automatically converts search spaces to BayesOptSearch's format:
  
  .. code-block:: python
  
      from ray import tune
      from ray.tune.search.bayesopt import BayesOptSearch
  
      config = {
          "width": tune.uniform(0, 20),
          "height": tune.uniform(-100, 100)
      }
  
      bayesopt = BayesOptSearch(metric="mean_loss", mode="min")
      tuner = tune.Tuner(
          my_func,
          tune_config=tune.TuneConfig(
              search_alg=baysopt,
          ),
          param_space=config,
      )
      tuner.fit()
  
  If you would like to pass the search space manually, the code would
  look like this:
  
  .. code-block:: python
  
      from ray import tune
      from ray.tune.search.bayesopt import BayesOptSearch
  
      space = {
          'width': (0, 20),
          'height': (-100, 100),
      }
      bayesopt = BayesOptSearch(space, metric="mean_loss", mode="min")
      tuner = tune.Tuner(
          my_func,
          tune_config=tune.TuneConfig(
              search_alg=bayesopt,
          ),
      )
      tuner.fit()
class_docstr_tok: ["Uses","fmfn\/BayesianOptimization","to","optimize","hyperparameters",".","fmfn\/BayesianOptimization","is","a","library","for","Bayesian","Optimization",".","More","info","can","be","found","here",":","https",":","\/\/github.com\/fmfn\/BayesianOptimization",".","This","searcher","will","automatically","filter","out","any","NaN",",","inf","or","-inf","results",".","You","will","need","to","install","fmfn\/BayesianOptimization","via","the","following",":","..","code-block",":",":","bash","pip","install","bayesian-optimization","Initializing","this","search","algorithm","with","a","``","space","``","requires","that","it's","in","the","``","BayesianOptimization","``","search","space","format",".","Otherwise",",","you","should","instead","pass","in","a","Tune","search","space","into","``","Tuner","(","param_space=","...",")","``",",","and","the","search","space","will","be","automatically","converted","for","you",".","See","this","`","BayesianOptimization","example","notebook","<","https",":","\/\/github.com\/fmfn\/BayesianOptimization\/blob\/master\/examples\/advanced-tour.ipynb",">","`","_","for","an","example",".","Args",":","space",":","Continuous","search","space",".","Parameters","will","be","sampled","from","this","space","which","will","be","used","to","run","trials",".","metric",":","The","training","result","objective","value","attribute",".","If","None","but","a","mode","was","passed",",","the","anonymous","metric","`","_metric","`","will","be","used","per","default",".","mode",":","One","of","{","min",",","max","}",".","Determines","whether","objective","is","minimizing","or","maximizing","the","metric","attribute",".","points_to_evaluate",":","Initial","parameter","suggestions","to","be","run","first",".","This","is","for","when","you","already","have","some","good","parameters","you","want","to","run","first","to","help","the","algorithm","make","better","suggestions","for","future","parameters",".","Needs","to","be","a","list","of","dicts","containing","the","configurations",".","utility_kwargs",":","Parameters","to","define","the","utility","function",".","The","default","value","is","a","dictionary","with","three","keys",":","-","kind",":","ucb","(","Upper","Confidence","Bound",")","-","kappa",":","2.576","-","xi",":","0.0","random_state",":","Used","to","initialize","BayesOpt",".","random_search_steps",":","Number","of","initial","random","searches",".","This","is","necessary","to","avoid","initial","local","overfitting","of","the","Bayesian","process",".","verbose",":","Sets","verbosity","level","for","BayesOpt","packages",".","patience",":","If","patience","is","set","and","we","'ve","repeated","a","trial","numerous","times",",","we","terminate","the","experiment",".","skip_duplicate",":","skip","duplicate","config","analysis",":","Optionally",",","the","previous","analysis","to","integrate",".","Tune","automatically","converts","search","spaces","to","BayesOptSearch","'s","format",":","..","code-block",":",":","python","from","ray","import","tune","from","ray.tune.search.bayesopt","import","BayesOptSearch","config","=","{","``","width","''",":","tune.uniform","(","0",",","20",")",",","``","height","''",":","tune.uniform","(","-100",",","100",")","}","bayesopt","=","BayesOptSearch","(","metric=","''","mean_loss","''",",","mode=","''","min","''",")","tuner","=","tune.Tuner","(","my_func",",","tune_config=tune.TuneConfig","(","search_alg=baysopt",",",")",",","param_space=config",",",")","tuner.fit","(",")","If","you","would","like","to","pass","the","search","space","manually",",","the","code","would","look","like","this",":","..","code-block",":",":","python","from","ray","import","tune","from","ray.tune.search.bayesopt","import","BayesOptSearch","space","=","{","'width","'",":","(","0",",","20",")",",","'height","'",":","(","-100",",","100",")",",","}","bayesopt","=","BayesOptSearch","(","space",",","metric=","''","mean_loss","''",",","mode=","''","min","''",")","tuner","=","tune.Tuner","(","my_func",",","tune_config=tune.TuneConfig","(","search_alg=bayesopt",",",")",",",")","tuner.fit","(",")"]
docstr: Register given tuple of params and results.
docstr_tok: ["Register","given","tuple","of","params","and","results","."]
code: def _register_result(self, params: Tuple[str], result: Dict):
      """Register given tuple of params and results."""
      if is_nan_or_inf(result[self.metric]):
          return
      self.optimizer.register(
          params, self._metric_op * result[self.metric]
      )
  
imports: from collections import defaultdict
  import logging
  import pickle
  import json
  from typing import Dict, List, Optional, Tuple, Any, TYPE_CHECKING
  from ray.tune.result import DEFAULT_METRIC
  from ray.tune.search.sample import Domain, Float, Quantized, Uniform
  from ray.tune.search import UNRESOLVED_SEARCH_SPACE, UNDEFINED_METRIC_MODE, UNDEFINED_SEARCH_SPACE, Searcher
  from ray.tune.search.variant_generator import parse_spec_vars
  from ray.tune.utils.util import is_nan_or_inf, unflatten_dict
  from ray.tune.utils import flatten_dict
label_desc: Use image node_id 7 for calling the BayesOptSearch obj's underlying member method code with example usage: obj._register_result(params, result) without return types