class_docstr: Holds the param-space coordinates (X) and target values (Y)
  Allows for constant-time appends while ensuring no duplicates are added
  
  Example
  -------
  >>> def target_func(p1, p2):
  >>>     return p1 + p2
  >>> pbounds = {'p1': (0, 1), 'p2': (1, 100)}
  >>> space = TargetSpace(target_func, pbounds, random_state=0)
  >>> x = np.array([4 , 5])
  >>> y = target_func(x)
  >>> space.register(x, y)
  >>> assert self.max()['target'] == 9
  >>> assert self.max()['params'] == {'p1': 1.0, 'p2': 2.0}
class_docstr_tok: ["Holds","the","param-space","coordinates","(","X",")","and","target","values","(","Y",")","Allows","for","constant-time","appends","while","ensuring","no","duplicates","are","added","Example","--","--","--","-",">",">",">","def","target_func","(","p1",",","p2",")",":",">",">",">","return","p1","+","p2",">",">",">","pbounds","=","{","'p1","'",":","(","0",",","1",")",",","'p2","'",":","(","1",",","100",")","}",">",">",">","space","=","TargetSpace","(","target_func",",","pbounds",",","random_state=0",")",">",">",">","x","=","np.array","(","[","4",",","5","]",")",">",">",">","y","=","target_func","(","x",")",">",">",">","space.register","(","x",",","y",")",">",">",">","assert","self.max","(",")","[","'target","'","]","==","9",">",">",">","assert","self.max","(",")","[","'params","'","]","==","{","'p1","'",":","1.0",",","'p2","'",":","2.0","}"]
docstr: Creates a random point within the bounds of the space.
  
  Returns
  ----------
  data: ndarray
      [1 x dim] array with dimensions corresponding to `self._keys`
  
  Example
  -------
  >>> target_func = lambda p1, p2: p1 + p2
  >>> pbounds = {'p1': (0, 1), 'p2': (1, 100)}
  >>> space = TargetSpace(target_func, pbounds, random_state=0)
  >>> space.random_sample()
  array([[ 55.33253689,   0.54488318]])
docstr_tok: ["Creates","a","random","point","within","the","bounds","of","the","space",".","Returns","--","--","--","--","--","data",":","ndarray","[","1","x","dim","]","array","with","dimensions","corresponding","to","`","self._keys","`","Example","--","--","--","-",">",">",">","target_func","=","lambda","p1",",","p2",":","p1","+","p2",">",">",">","pbounds","=","{","'p1","'",":","(","0",",","1",")",",","'p2","'",":","(","1",",","100",")","}",">",">",">","space","=","TargetSpace","(","target_func",",","pbounds",",","random_state=0",")",">",">",">","space.random_sample","(",")","array","(","[","[","55.33253689",",","0.54488318","]","]",")"]
code: def random_sample(self):
      """
      Creates a random point within the bounds of the space.
  
      Returns
      ----------
      data: ndarray
          [1 x dim] array with dimensions corresponding to `self._keys`
  
      Example
      -------
      >>> target_func = lambda p1, p2: p1 + p2
      >>> pbounds = {'p1': (0, 1), 'p2': (1, 100)}
      >>> space = TargetSpace(target_func, pbounds, random_state=0)
      >>> space.random_sample()
      array([[ 55.33253689,   0.54488318]])
      """
      data = np.empty((1, self.dim))
      for col, (lower, upper) in enumerate(self._bounds):
          data.T[col] = self.random_state.uniform(lower, upper, size=1)
      return data.ravel()
  
imports: import numpy
  from warnings import warn
  from .util import ensure_rng, NotUniqueError
  from .util import Colours
label_desc: Use image node_id 18 for calling the TargetSpace obj's underlying member method code with example usage: obj.random_sample() and returns: data