saealib.GlobalSurrogateManager#
- class saealib.GlobalSurrogateManager(surrogate, training_set=None, accuracy_evaluator=None)[source]#
Bases:
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.
- Parameters:
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)[source]#
- Parameters:
surrogate (Surrogate)
training_set (TrainingSet | None)
accuracy_evaluator (AccuracyEvaluator | None)
- GlobalSurrogateManager.fit(archive, ctx=None)[source]#
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.- Parameters:
archive (Archive)
ctx (OptimizationState | None)
- Return type:
None
- GlobalSurrogateManager.on_generation_end(gen, archive, ctx=None)#
End-of-generation hook; override to update internal state.
- Parameters:
gen (int)
archive (Archive)
ctx (OptimizationState | None)
- Return type:
None
- GlobalSurrogateManager.predict(candidates_x, archive, ctx=None, *, refit=True)[source]#
Fit on full archive, then predict all candidates at once.
- Parameters:
candidates_x (np.ndarray)
archive (Archive)
ctx (OptimizationState | None)
refit (bool)
- Return type:
- GlobalSurrogateManager.with_on_generation_end(fn)#
Return a copy of this manager with
fnappended to the hook.- Parameters:
fn (callable) –
fn(gen, archive, ctx) -> None- Returns:
Shallow copy with the hook registered.
- Return type: