class_docstr: Holds the param-space coordinates (X) and target values (Y)
  
  Parameters
  ----------
  pbounds : dict
      Dictionary with parameters names and legal values.
  
  random_state : int, RandomState, or None
      optionally specify a seed for a random number generator, by default None.
class_docstr_tok: ["Holds","the","param-space","coordinates","(","X",")","and","target","values","(","Y",")","Parameters","--","--","--","--","--","pbounds",":","dict","Dictionary","with","parameters","names","and","legal","values",".","random_state",":","int",",","RandomState",",","or","None","optionally","specify","a","seed","for","a","random","number","generator",",","by","default","None","."]
docstr: array to dict
  
  maintain int type if the paramters is defined as int in search_space.json
  Parameters
  ----------
  x : numpy array
      array format of parameters
  
  Returns
  -------
  dict
      dict format of parameters
docstr_tok: ["array","to","dict","maintain","int","type","if","the","paramters","is","defined","as","int","in","search_space.json","Parameters","--","--","--","--","--","x",":","numpy","array","array","format","of","parameters","Returns","--","--","--","-","dict","dict","format","of","parameters"]
code: def array_to_params(self, x):
      """
      array to dict
  
      maintain int type if the paramters is defined as int in search_space.json
      Parameters
      ----------
      x : numpy array
          array format of parameters
  
      Returns
      -------
      dict
          dict format of parameters
      """
      try:
          assert len(x) == len(self.keys)
      except AssertionError:
          raise ValueError(
              "Size of array ({}) is different than the ".format(len(x))
              + "expected number of parameters ({}).".format(self.dim)
          )
  
      params = {}
      for i, _bound in enumerate(self._bounds):
          if _bound["_type"] == "choice" and all(
              isinstance(val, int) for val in _bound["_value"]
          ):
              params.update({self.keys[i]: int(x[i])})
          elif _bound["_type"] in ["randint"]:
              params.update({self.keys[i]: int(x[i])})
          else:
              params.update({self.keys[i]: x[i]})
  
      return params
  
file_path: nni/nni/algorithms/hpo/gp_tuner/target_space.py
imports: import numpy
  import nni.parameter_expressions
label_desc: Use image node_id 10 for calling the TargetSpace obj's underlying member method code with example usage: obj.array_to_params(x) and returns: params