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)
              or numpy.issubdtype(value, numpy.integer)
              or numpy.issubdtype(value, numpy.floating)
          ):
              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:
          v = "anyOf" if "anyOf" in self.config else "oneOf"
          data = self.config[v]
  
          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
  
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 6 for calling the Hyperparameter obj's underlying member method code with example usage: obj.convertToFlatValues(params) and returns: flatValues, flatValues, flatValues, flatValues, flatValues