class_docstr: This class represents a hyperparameter.
class_docstr_tok: ["This","class","represents","a","hyperparameter","."]
code: def createHyperoptSpace(self, lockedValues=None):
      name = self.root
  
      if lockedValues is None:
          lockedValues = {}
  
      if "anyOf" in self.config or "oneOf" in self.config:
          v = "anyOf" if "anyOf" in self.config else "oneOf"
          data = self.config[v]
  
          subSpaces = [
              Hyperparameter(
                  param, self, name + "." + str(index)
              ).createHyperoptSpace(lockedValues)
              for index, param in enumerate(data)
          ]
          for index, space in enumerate(subSpaces):
              space["$index"] = index
  
          choices = hp.choice(self.hyperoptVariableName, subSpaces)
  
          return choices
      elif "enum" in self.config:
          if self.name in lockedValues:
              return lockedValues[self.name]
  
          choices = hp.choice(
              self.hyperoptVariableName, self.config["enum"]
          )
          return choices
      elif "constant" in self.config:
          if self.name in lockedValues:
              return lockedValues[self.name]
  
          return self.config["constant"]
      elif self.config["type"] == "object":
          space = {}
          for key in self.config["properties"].keys():
              config = self.config["properties"][key]
              space[key] = Hyperparameter(
                  config, self, name + "." + key
              ).createHyperoptSpace(lockedValues)
          return space
      elif self.config["type"] == "number":
          if self.name in lockedValues:
              return lockedValues[self.name]
  
          mode = self.config.get("mode", "uniform")
          scaling = self.config.get("scaling", "linear")
  
          if mode == "uniform":
              min = self.config.get("min", 0)
              max = self.config.get("max", 1)
              rounding = self.config.get("rounding", None)
  
              if scaling == "linear":
                  if rounding is not None:
                      return hp.quniform(
                          self.hyperoptVariableName, min, max, rounding
                      )
                  else:
                      return hp.uniform(
                          self.hyperoptVariableName, min, max
                      )
              elif scaling == "logarithmic":
                  if rounding is not None:
                      return hp.qloguniform(
                          self.hyperoptVariableName,
                          math.log(min),
                          math.log(max),
                          rounding,
                      )
                  else:
                      return hp.loguniform(
                          self.hyperoptVariableName,
                          math.log(min),
                          math.log(max),
                      )
          if mode == "randint":
              min = self.config.get("min")
              max = self.config.get("max")
              return hp.randint(self.hyperoptVariableName, min, max)
  
          if mode == "normal":
              mean = self.config.get("mean", 0)
              stddev = self.config.get("stddev", 1)
              rounding = self.config.get("rounding", None)
  
              if scaling == "linear":
                  if rounding is not None:
                      return hp.qnormal(
                          self.hyperoptVariableName,
                          mean,
                          stddev,
                          rounding,
                      )
                  else:
                      return hp.normal(
                          self.hyperoptVariableName, mean, stddev
                      )
              elif scaling == "logarithmic":
                  if rounding is not None:
                      return hp.qlognormal(
                          self.hyperoptVariableName,
                          math.log(mean),
                          math.log(stddev),
                          rounding,
                      )
                  else:
                      return hp.lognormal(
                          self.hyperoptVariableName,
                          math.log(mean),
                          math.log(stddev),
                      )
  
imports: from hyperopt import hp
  from contextlib import contextmanager
  import re
  import functools
  import random
  import numpy
  import numpy.random
  import pkg_resources
  import tempfile
  import scipy.stats
  import os
  import math
  import hyperopt
  import datetime
  import json
  import copy
label_desc: Use image node_id 2 for calling the Hyperparameter obj's underlying member method code with example usage: obj.createHyperoptSpace(lockedValues) and returns: choices, choices, lockedValues, self, lockedValues, space, lockedValues, hp, hp, hp, hp, hp, hp, hp, hp, hp