saealib.EHVIAcquisition#
- class saealib.EHVIAcquisition(n_samples=256, reference_point=None, rng=None, direction=None)[ソース]#
ベースクラス:
PointwiseAcquisitionExpected Hypervolume Improvement (EHVI) acquisition function.
Estimates EHVI via Monte Carlo sampling. The exact EHVI and HVI concepts follow Hupkens (2015) and Daulton et al. (2020); the sample average below is the approximation used by this implementation:
EHVI(x) = (1/S) * sum_s HVI(y_s, P, r) y_s ~ N(mu(x), diag(sigma^2(x))) [independent objectives]
where HVI(y, P, r) = HV(P u {y}, r) - HV(P, r).
archive.f,reference_point, and the predicted mean are internally converted to minimisation convention viadirection_to_minimize_sign(seedirectionbelow) before the formula above runs.- パラメータ:
n_samples (int) -- Number of MC samples per candidate. Default: 256.
reference_point (array-like or None) -- Hypervolume reference point, given in raw objective space (i.e. in the same convention as
problem.direction, not necessarily minimisation). If None, auto-computed from the archive nadir with a 10 % margin.rng (np.random.Generator or None) -- Random number generator for MC sampling.
direction (np.ndarray or None) -- Per-objective optimization direction (+1 = maximize, -1 = minimize). shape: (n_obj,).
None(default) means already-minimize, so behaviour for existing minimize-only callers is unchanged; when unset, it is auto-injected fromproblem.directionat run start.
Methods
Extract the Pareto front and (if needed) compute the reference point. |
|
Return the expected-hypervolume-improvement contract. |
|
Reject |
|
Delegate to |
|
Estimate EHVI via Monte Carlo sampling. |
Method Details
- EHVIAcquisition.__init__(n_samples=256, reference_point=None, rng=None, direction=None)[ソース]#
- パラメータ:
n_samples (int)
reference_point (ArrayLike | None)
rng (Generator | None)
direction (ndarray | None)
- 戻り値の型:
None
- EHVIAcquisition.compute_reference(archive, rng=None)[ソース]#
Extract the Pareto front and (if needed) compute the reference point.
- パラメータ:
archive (Archive) -- Archive of evaluated solutions.
rng (np.random.Generator | None)
- 戻り値:
(pareto_f, ref_point, base_hv)— non-dominated objective matrix, hypervolume reference point, and current hypervolume.- 戻り値の型:
tuple
- EHVIAcquisition.evaluate(candidates_x, prediction, archive, ctx=None, *, prepared=<object object>)#
Reject
prediction is None, resolve the reference, thenscore().See
AcquisitionFunction.evaluate()for the shared parameter contract, including the_UNSETvs. explicitprepared=Nonedistinction.- パラメータ:
candidates_x (np.ndarray)
prediction (SurrogatePrediction | None)
archive (Archive)
ctx (OptimizationState | None)
prepared (Any)
- 戻り値の型:
AcquisitionResult
- EHVIAcquisition.prepare(archive, ctx=None)#
Delegate to
compute_reference(archive, rng=ctx.rng if ctx else None).- パラメータ:
archive (Archive)
ctx (OptimizationState | None)
- 戻り値の型:
Any
- EHVIAcquisition.score(prediction, reference, rng=None)[ソース]#
Estimate EHVI via Monte Carlo sampling.
- パラメータ:
prediction (SurrogatePrediction) -- Surrogate predictions. Must have std (has_uncertainty == True).
reference (tuple) --
(pareto_f, ref_point, base_hv)fromcompute_reference.rng (np.random.Generator or None, optional) -- Random number generator. When provided (e.g.
ctx.rng), it is used instead of the instance-level_rngso all randomness flows through the master RNG.
- 戻り値:
EHVI scores. shape: (n_samples,). Higher is better.
- 戻り値の型:
np.ndarray
- 例外:
TypeError -- If prediction does not contain uncertainty estimates.