saealib.ManagerSwitcher#
- class saealib.ManagerSwitcher(primary, fallback, *, metric='spearman', threshold=0.5)[source]#
Bases:
AccuracyBasedSurrogateSwitcher[SurrogateManager]Switch between two surrogate managers based on an accuracy threshold.
Returns
primarywhenmetric >= threshold,fallbackotherwise, including when accuracy is unavailable or the metric is non-finite.- Parameters:
primary (SurrogateManager) – Manager used when accuracy is satisfactory.
fallback (SurrogateManager) – Manager used when accuracy is poor or not yet available.
metric (str) – Metric key in
SurrogateAccuracy. Default:"spearman".threshold (float) – Minimum acceptable metric value. Default:
0.5.
Methods
Return the manager-switcher contract. |
|
Return primary or fallback based on the metric threshold. |
Method Details
- ManagerSwitcher.__init__(primary, fallback, *, metric='spearman', threshold=0.5)[source]#
- Parameters:
primary (SurrogateManager)
fallback (SurrogateManager)
metric (str)
threshold (float)
- Return type:
None
- ManagerSwitcher.switch(accuracy)[source]#
Return primary or fallback based on the metric threshold.
- Parameters:
accuracy (SurrogateAccuracy | None)
- Return type: