MCPcopy Create free account
hub / github.com/bayesian-optimization/BayesianOptimization / allowed

Method allowed

bayes_opt/constraint.py:245–263  ·  view source on GitHub ↗

Check whether `constraint_values` fulfills the specified limits. Parameters ---------- constraint_values : np.ndarray of shape (n_samples, n_constraints) The values of the constraint function. Returns ------- np.ndarrray of shape (n_samp

(self, constraint_values: NDArray[Float])

Source from the content-addressed store, hash-verified

243 return result.reshape(*X_shape[:-1], len(self._lb))
244
245 def allowed(self, constraint_values: NDArray[Float]) -> NDArray[np.bool_]:
246 """Check whether `constraint_values` fulfills the specified limits.
247
248 Parameters
249 ----------
250 constraint_values : np.ndarray of shape (n_samples, n_constraints)
251 The values of the constraint function.
252
253
254 Returns
255 -------
256 np.ndarrray of shape (n_samples,)
257 Specifying wheter the constraints are fulfilled.
258
259 """
260 if self._lb.size == 1:
261 return np.less_equal(self._lb, constraint_values) & np.less_equal(constraint_values, self._ub)
262
263 return np.all(constraint_values <= self._ub, axis=-1) & np.all(constraint_values >= self._lb, axis=-1)

Callers 2

maskMethod · 0.80
resMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected