MCPcopy Index your code
hub / github.com/bayesian-optimization/BayesianOptimization / _as_array

Method _as_array

bayes_opt/target_space.py:412–422  ·  view source on GitHub ↗
(self, x: Any)

Source from the content-addressed store, hash-verified

410 return mask
411
412 def _as_array(self, x: Any) -> NDArray[Float]:
413 try:
414 x = np.asarray(x, dtype=float)
415 except TypeError:
416 x = self.params_to_array(x)
417
418 x = x.ravel()
419 if x.size != self.dim:
420 msg = f"Size of array ({len(x)}) is different than the expected number of ({self.dim})."
421 raise ValueError(msg)
422 return x
423
424 def register(
425 self, params: ParamsType, target: float, constraint_value: float | NDArray[Float] | None = None

Callers 2

registerMethod · 0.95
probeMethod · 0.95

Calls 1

params_to_arrayMethod · 0.95

Tested by

no test coverage detected