saealib.ExpectedImprovement#
- class saealib.ExpectedImprovement(xi=0.01, obj_idx=0, reference=None, direction=None)[source]#
Bases:
PointwiseAcquisitionExpected Improvement (EI) acquisition function.
EI balances exploration and exploitation by computing the expected amount of improvement over the current best observed value.
For single-objective minimization:
EI(x) = E[max(f_best - f(x), 0)] = (f_best - mu) * Phi(Z) + sigma * phi(Z) where Z = (f_best - mu) / sigma
Requires a surrogate that provides uncertainty estimates (std).
- Parameters:
xi (float) – Exploration-exploitation trade-off parameter. Higher values encourage more exploration. Default: 0.01.
obj_idx (int) – Index of the objective to optimize. Used for multi-objective problems where EI is applied to a single objective. Default: 0.
direction (np.ndarray or None) – Per-objective optimization direction (+1 = maximize, -1 = minimize). shape: (n_obj,).
archive.f, a user-suppliedreference, and the predicted mean are converted to minimize-space viadirection_to_minimize_signbefore the (minimize-only) EI formula above runs.None(default) means already-minimize; when unset, it is auto-injected fromproblem.directionat run start.reference (Any)
References
[24]: Jones, D. R., Schonlau, M., & Welch, W. J. (1998). Efficient global optimization of expensive black-box functions. Journal of Global Optimization, 13(4), 455-492.
Methods
Return fixed reference if set, otherwise component-wise best from archive. |
|
Return the pointwise acquisition contract. |
|
Reject |
|
Delegate to |
|
Compute Expected Improvement scores. |
Method Details
- ExpectedImprovement.__init__(xi=0.01, obj_idx=0, reference=None, direction=None)[source]#
- Parameters:
xi (float)
obj_idx (int)
reference (Any)
direction (ndarray | None)
- ExpectedImprovement.compute_reference(archive, rng=None)[source]#
Return fixed reference if set, otherwise component-wise best from archive.
- Parameters:
archive (Archive)
rng (np.random.Generator | None)
- Return type:
np.ndarray
- ExpectedImprovement.contract()#
Return the pointwise acquisition contract.
- Return type:
- ExpectedImprovement.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.- Parameters:
candidates_x (np.ndarray)
prediction (SurrogatePrediction | None)
archive (Archive)
ctx (OptimizationState | None)
prepared (Any)
- Return type:
AcquisitionResult
- ExpectedImprovement.prepare(archive, ctx=None)#
Delegate to
compute_reference(archive, rng=ctx.rng if ctx else None).- Parameters:
archive (Archive)
ctx (OptimizationState | None)
- Return type:
Any
- ExpectedImprovement.score(prediction, reference, rng=None)[source]#
Compute Expected Improvement scores.
- Parameters:
prediction (SurrogatePrediction) – Surrogate predictions. Must have std (has_uncertainty == True).
reference (Any) – Current best objective value. Scalar or ndarray of shape (n_obj,). The objective at index obj_idx is used.
rng (Generator | None)
- Returns:
EI scores. shape: (n_samples,). Higher is better.
- Return type:
np.ndarray
- Raises:
TypeError – If prediction does not contain uncertainty estimates.