saealib.PairwiseSurrogateManager#
- class saealib.PairwiseSurrogateManager(surrogate, training_set=None, n_ref=10)[ソース]#
ベースクラス:
SurrogateManagerSurrogate manager for pairwise comparison surrogates.
predict()pairs each candidate with reference points sampled once per call from the archive and averages the predicted win probability over all pairs, returning the result as a"win_rate"prediction channel. Pair withWinRateAcquisitionThis manager performs the full reference-sampling + pair-construction +predict_proba()+ per-candidate win-rate-aggregation sequence itself, rather than the usual "manager predicts, then acquisition scores" split -- the(candidate, reference)pairs are not known until this manager's own reference-sampling logic runs, andAcquisitionFunctiondeliberately has noSurrogate/SurrogateManageraccess to construct and predict on them itself.The surrogate must be a
ComparisonSurrogatethat implementspredict_proba().- パラメータ:
surrogate (ComparisonSurrogate) -- Pairwise comparison surrogate (e.g.
SklearnRFCClassificationSurrogate).training_set (TrainingSet or None) -- Training data builder. Defaults to
PairwiseComparisonSet().ctxis required when usingPairwiseComparisonSet.n_ref (int) -- Number of archive points sampled, once per
predict()call, as the shared reference set every candidate in that call is compared against. When the archive has fewer thann_refpoints all are used.
Methods
Return the pairwise-manager contract. |
|
Fit the surrogate on pairwise comparison training data. |
|
End-of-generation hook; override to update internal state. |
|
Predict per-candidate mean win rate against archive reference points. |
|
Return a copy of this manager with |
Method Details
- PairwiseSurrogateManager.__init__(surrogate, training_set=None, n_ref=10)[ソース]#
- パラメータ:
surrogate (ComparisonSurrogate)
training_set (TrainingSet | None)
n_ref (int)
- PairwiseSurrogateManager.fit(archive, ctx=None)[ソース]#
Fit the surrogate on pairwise comparison training data.
- パラメータ:
archive (Archive) -- Archive of evaluated solutions.
ctx (OptimizationState or None) -- Required when the training set is
PairwiseComparisonSet(provides the comparator and rng).
- 戻り値の型:
None
- PairwiseSurrogateManager.on_generation_end(gen, archive, ctx=None)#
End-of-generation hook; override to update internal state.
- パラメータ:
gen (int)
archive (Archive)
ctx (OptimizationState | None)
- 戻り値の型:
None
- PairwiseSurrogateManager.predict(candidates_x, archive, ctx=None, *, refit=True)[ソース]#
Predict per-candidate mean win rate against archive reference points.
Draws a reference subset from the archive exactly once per call (not once per candidate) -- this RNG-consumption timing is a once per candidate batch.
- パラメータ:
candidates_x (np.ndarray) -- Candidate design variable matrix. shape: (n_candidates, dim)
archive (Archive) -- Archive of evaluated solutions.
ctx (OptimizationState or None) -- Optimization context. Required when
refit=Trueand the training set isPairwiseComparisonSet, and to supplyctx.rngfor reference sampling (falls back to a fresh unseeded generator whenctxisNone).refit (bool) -- If
True(default), fit the surrogate before predicting.
- 戻り値:
A single
"win_rate"channel, deliberately not named"objective": naming it"objective"would make predicted objective.valueshape:(n_candidates, 1).- 戻り値の型:
- PairwiseSurrogateManager.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.
- 戻り値の型: