class_docstr: This class represents a hyperparameter.
class_docstr_tok: ["This","class","represents","a","hyperparameter","."]
code: def convertToFlatValues(self, params):
      flatParams = {}
  
      def recurse(key, value, root):
          result_key = root + "." + key
          if isinstance(value, str):
              flatParams[result_key[1:]] = value
          elif (
              isinstance(value, float)
              or isinstance(value, bool)
              or isinstance(value, int)
          ):
              flatParams[result_key[1:]] = value
          elif isinstance(value, dict):
              for subkey, subvalue in value.items():
                  recurse(subkey, subvalue, result_key)
  
      for key in params.keys():
          value = params[key]
          recurse(key, value, "")
  
      flatValues = {}
  
      if "anyOf" in self.config or "oneOf" in self.config:
          if "anyOf" in self.config:
              data = self.config["anyOf"]
          else:
              data = self.config["oneOf"]
  
          subParameterIndex = flatParams[
              self.resultVariableName + ".$index"
          ]
          flatValues[self.name] = subParameterIndex
  
          for index, param in enumerate(data):
              subParameter = Hyperparameter(
                  param, self, self.root + "." + str(index)
              )
  
              if index == subParameterIndex:
                  subFlatValues = subParameter.convertToFlatValues(
                      flatParams
                  )
                  for key in subFlatValues:
                      flatValues[key] = subFlatValues[key]
              else:
                  for flatParam in subParameter.getFlatParameters():
                      flatValues[flatParam.name] = ""
  
          return flatValues
      elif "constant" in self.config:
          flatValues[self.name] = flatParams[self.resultVariableName]
          return flatValues
      elif "enum" in self.config:
          flatValues[self.name] = flatParams[self.resultVariableName]
          return flatValues
      elif self.config["type"] == "object":
          for key in self.config["properties"].keys():
              config = self.config["properties"][key]
  
              subFlatValues = Hyperparameter(
                  config, self, self.root + "." + key
              ).convertToFlatValues(flatParams)
  
              for key in subFlatValues:
                  flatValues[key] = subFlatValues[key]
  
              if self.name == "":
                  for key in params.keys():
                      if key.startswith("$"):
                          flatValues[key] = params[key]
  
          return flatValues
      elif self.config["type"] == "number":
          flatValues[self.name] = flatParams[self.resultVariableName]
          return flatValues
  
file_path: hypermax/hypermax/hyperparameter.py
imports: from hyperopt import hp
  import math
  from pprint import pprint
  import re
label_desc: Use image node_id 6 for calling the Hyperparameter obj's underlying member method code with example usage: obj.convertToFlatValues(params) and returns: flatValues, flatValues, flatValues, flatValues, flatValues