saealib.SurrogateManager#
- class saealib.SurrogateManager[ソース]#
ベースクラス:
ABCAbstract base class for surrogate managers.
A SurrogateManager is narrowed to training and prediction management It coordinates
TrainingSetconstruction, model fitting, and prediction, and returns aSurrogatePredictionfor callers.- last_accuracy#
Accuracy metrics computed after the most recent
fit()call.Noneuntil the first fit or when no evaluator is configured.- Type:
SurrogateAccuracy or None
Methods
Return the surrogate-manager contract. |
|
Pre-fit the surrogate on the archive. |
|
End-of-generation hook; override to update internal state. |
|
Predict candidate solutions using the surrogate model. |
|
Return a copy of this manager with |
Method Details
- SurrogateManager.__init__()#
- SurrogateManager.fit(archive, ctx=None)[ソース]#
Pre-fit the surrogate on the archive.
Call once before a sequence of
predict(..., refit=False)calls when the archive does not change between calls (e.g. the surrogate-only inner loop ofGenerationBasedStrategy). The default implementation is a no-op; override in managers that maintain a fitted surrogate model.- パラメータ:
archive (Archive) -- Archive of evaluated solutions used for surrogate training.
ctx (OptimizationState or None, optional) -- Current optimization context.
- 戻り値の型:
None
- SurrogateManager.on_generation_end(gen, archive, ctx=None)[ソース]#
End-of-generation hook; override to update internal state.
- パラメータ:
gen (int)
archive (Archive)
ctx (OptimizationState | None)
- 戻り値の型:
None
- abstractmethod SurrogateManager.predict(candidates_x, archive, ctx=None, *, refit=True)[ソース]#
Predict candidate solutions using the surrogate model.
- パラメータ:
candidates_x (np.ndarray) -- Candidate design variable matrix. shape: (n_candidates, dim)
archive (Archive) -- Archive of evaluated solutions used for surrogate training.
ctx (OptimizationState or None, optional) -- Current optimization context. Passed to
TrainingSet.buildfor strategies that require comparator or population access.refit (bool, optional) -- If
True(default), fit the surrogate before predicting. PassFalseafter an explicitfit()call to skip redundant re-fitting when the archive has not changed.
- 戻り値:
One batched prediction covering every row of
candidates_x. Acquisition scoring is not performed here — pass the result to anAcquisitionFunction.- 戻り値の型: