saealib.GlobalSurrogateManager#
- class saealib.GlobalSurrogateManager(surrogate, training_set=None, accuracy_evaluator=None)[ソース]#
ベースクラス:
SurrogateManagerSurrogate manager that fits once on the full archive.
Fits the surrogate on all archived solutions, then predicts and scores all candidates in a single batch. Suitable when global approximation quality is sufficient.
- パラメータ:
surrogate (Surrogate) -- Surrogate model instance.
training_set (TrainingSet or None) -- Strategy object for building training data. Defaults to
ArchiveObjectiveSet().accuracy_evaluator (AccuracyEvaluator or None) -- If provided,
fit()computes accuracy metrics after each fit and stores them inlast_accuracy.
Methods
Return the global-manager contract. |
|
Fit the surrogate on the full archive. |
|
End-of-generation hook; override to update internal state. |
|
Fit on full archive, then predict all candidates at once. |
|
Return a copy of this manager with |
Method Details
- GlobalSurrogateManager.__init__(surrogate, training_set=None, accuracy_evaluator=None)[ソース]#
- パラメータ:
surrogate (Surrogate)
training_set (TrainingSet | None)
accuracy_evaluator (AccuracyEvaluator | None)
- GlobalSurrogateManager.fit(archive, ctx=None)[ソース]#
Fit the surrogate on the full archive.
If an
accuracy_evaluatorwas supplied at construction, accuracy metrics are computed immediately after fitting and stored inlast_accuracy.- パラメータ:
archive (Archive)
ctx (OptimizationState | None)
- 戻り値の型:
None
- GlobalSurrogateManager.on_generation_end(gen, archive, ctx=None)#
End-of-generation hook; override to update internal state.
- パラメータ:
gen (int)
archive (Archive)
ctx (OptimizationState | None)
- 戻り値の型:
None
- GlobalSurrogateManager.predict(candidates_x, archive, ctx=None, *, refit=True)[ソース]#
Fit on full archive, then predict all candidates at once.
- パラメータ:
candidates_x (np.ndarray)
archive (Archive)
ctx (OptimizationState | None)
refit (bool)
- 戻り値の型:
- GlobalSurrogateManager.with_on_generation_end(fn)#
Return a copy of this manager with
fnappended to the hook.- パラメータ:
fn (callable) --
fn(gen, archive, ctx) -> None- 戻り値:
Shallow copy with the hook registered.
- 戻り値の型: