class_docstr: Uses `Ax <https://ax.dev/>`_ to optimize hyperparameters.
  
  Ax is a platform for understanding, managing, deploying, and
  automating adaptive experiments. Ax provides an easy to use
  interface with BoTorch, a flexible, modern library for Bayesian
  optimization in PyTorch. More information can be found in https://ax.dev/.
  
  To use this search algorithm, you must install Ax and sqlalchemy:
  
  .. code-block:: bash
  
      $ pip install ax-platform sqlalchemy
  
  Parameters:
      space: Parameters in the experiment search space.
          Required elements in the dictionaries are: "name" (name of
          this parameter, string), "type" (type of the parameter: "range",
          "fixed", or "choice", string), "bounds" for range parameters
          (list of two values, lower bound first), "values" for choice
          parameters (list of values), and "value" for fixed parameters
          (single value).
      metric: Name of the metric used as objective in this
          experiment. This metric must be present in `raw_data` argument
          to `log_data`. This metric must also be present in the dict
          reported/returned by the Trainable. If None but a mode was passed,
          the `ray.tune.result.DEFAULT_METRIC` will be used per default.
      mode: One of {min, max}. Determines whether objective is
          minimizing or maximizing the metric attribute. Defaults to "max".
      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.
      parameter_constraints: Parameter constraints, such as
          "x3 >= x4" or "x3 + x4 >= 2".
      outcome_constraints: Outcome constraints of form
          "metric_name >= bound", like "m1 <= 3."
      ax_client: Optional AxClient instance. If this is set, do
          not pass any values to these parameters: `space`, `metric`,
          `parameter_constraints`, `outcome_constraints`.
      **ax_kwargs: Passed to AxClient instance. Ignored if `AxClient` is not
          None.
  
  Tune automatically converts search spaces to Ax's format:
  
  .. code-block:: python
  
      from ray import train, tune
      from ray.tune.search.ax import AxSearch
  
      config = {
          "x1": tune.uniform(0.0, 1.0),
          "x2": tune.uniform(0.0, 1.0)
      }
  
      def easy_objective(config):
          for i in range(100):
              intermediate_result = config["x1"] + config["x2"] * i
              train.report({"score": intermediate_result})
  
      ax_search = AxSearch()
      tuner = tune.Tuner(
          easy_objective,
          tune_config=tune.TuneConfig(
              search_alg=ax_search,
              metric="score",
              mode="max",
          ),
          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 train, tune
      from ray.tune.search.ax import AxSearch
  
      parameters = [
          {"name": "x1", "type": "range", "bounds": [0.0, 1.0]},
          {"name": "x2", "type": "range", "bounds": [0.0, 1.0]},
      ]
  
      def easy_objective(config):
          for i in range(100):
              intermediate_result = config["x1"] + config["x2"] * i
              train.report({"score": intermediate_result})
  
      ax_search = AxSearch(space=parameters, metric="score", mode="max")
      tuner = tune.Tuner(
          easy_objective,
          tune_config=tune.TuneConfig(
              search_alg=ax_search,
          ),
      )
      tuner.fit()
class_docstr_tok: ["Uses","`","Ax","<","https",":","\/\/ax.dev\/",">","`","_","to","optimize","hyperparameters",".","Ax","is","a","platform","for","understanding",",","managing",",","deploying",",","and","automating","adaptive","experiments",".","Ax","provides","an","easy","to","use","interface","with","BoTorch",",","a","flexible",",","modern","library","for","Bayesian","optimization","in","PyTorch",".","More","information","can","be","found","in","https",":","\/\/ax.dev\/",".","To","use","this","search","algorithm",",","you","must","install","Ax","and","sqlalchemy",":","..","code-block",":",":","bash","$","pip","install","ax-platform","sqlalchemy","Parameters",":","space",":","Parameters","in","the","experiment","search","space",".","Required","elements","in","the","dictionaries","are",":","``","name","''","(","name","of","this","parameter",",","string",")",",","``","type","''","(","type","of","the","parameter",":","``","range","''",",","``","fixed","''",",","or","``","choice","''",",","string",")",",","``","bounds","''","for","range","parameters","(","list","of","two","values",",","lower","bound","first",")",",","``","values","''","for","choice","parameters","(","list","of","values",")",",","and","``","value","''","for","fixed","parameters","(","single","value",")",".","metric",":","Name","of","the","metric","used","as","objective","in","this","experiment",".","This","metric","must","be","present","in","`","raw_data","`","argument","to","`","log_data","`",".","This","metric","must","also","be","present","in","the","dict","reported\/returned","by","the","Trainable",".","If","None","but","a","mode","was","passed",",","the","`","ray.tune.result.DEFAULT_METRIC","`","will","be","used","per","default",".","mode",":","One","of","{","min",",","max","}",".","Determines","whether","objective","is","minimizing","or","maximizing","the","metric","attribute",".","Defaults","to","``","max","''",".","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",".","parameter_constraints",":","Parameter","constraints",",","such","as","``","x3",">","=","x4","''","or","``","x3","+","x4",">","=","2","''",".","outcome_constraints",":","Outcome","constraints","of","form","``","metric_name",">","=","bound","''",",","like","``","m1","<","=","3",".","''","ax_client",":","Optional","AxClient","instance",".","If","this","is","set",",","do","not","pass","any","values","to","these","parameters",":","`","space","`",",","`","metric","`",",","`","parameter_constraints","`",",","`","outcome_constraints","`",".","*","*","ax_kwargs",":","Passed","to","AxClient","instance",".","Ignored","if","`","AxClient","`","is","not","None",".","Tune","automatically","converts","search","spaces","to","Ax","'s","format",":","..","code-block",":",":","python","from","ray","import","train",",","tune","from","ray.tune.search.ax","import","AxSearch","config","=","{","``","x1","''",":","tune.uniform","(","0.0",",","1.0",")",",","``","x2","''",":","tune.uniform","(","0.0",",","1.0",")","}","def","easy_objective","(","config",")",":","for","i","in","range","(","100",")",":","intermediate_result","=","config","[","``","x1","''","]","+","config","[","``","x2","''","]","*","i","train.report","(","{","``","score","''",":","intermediate_result","}",")","ax_search","=","AxSearch","(",")","tuner","=","tune.Tuner","(","easy_objective",",","tune_config=tune.TuneConfig","(","search_alg=ax_search",",","metric=","''","score","''",",","mode=","''","max","''",",",")",",","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","train",",","tune","from","ray.tune.search.ax","import","AxSearch","parameters","=","[","{","``","name","''",":","``","x1","''",",","``","type","''",":","``","range","''",",","``","bounds","''",":","[","0.0",",","1.0","]","}",",","{","``","name","''",":","``","x2","''",",","``","type","''",":","``","range","''",",","``","bounds","''",":","[","0.0",",","1.0","]","}",",","]","def","easy_objective","(","config",")",":","for","i","in","range","(","100",")",":","intermediate_result","=","config","[","``","x1","''","]","+","config","[","``","x2","''","]","*","i","train.report","(","{","``","score","''",":","intermediate_result","}",")","ax_search","=","AxSearch","(","space=parameters",",","metric=","''","score","''",",","mode=","''","max","''",")","tuner","=","tune.Tuner","(","easy_objective",",","tune_config=tune.TuneConfig","(","search_alg=ax_search",",",")",",",")","tuner.fit","(",")"]
code: def save(self, checkpoint_path: str):
      save_object = self.__dict__
      with open(checkpoint_path, "wb") as outputFile:
          cloudpickle.dump(save_object, outputFile)
  
imports: import copy
  import numpy
  from typing import Dict, List, Optional, Union
  from ray import cloudpickle
  from ray.tune.result import DEFAULT_METRIC
  from ray.tune.search.sample import Categorical, Float, Integer, LogUniform, 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 flatten_dict, unflatten_list_dict
  import logging
label_desc: Use image node_id 8 for calling the AxSearch obj's underlying member method code with example usage: obj.save(checkpoint_path) without return types