saealib.ManagerSwitcher#
- class saealib.ManagerSwitcher(primary, fallback, *, metric='spearman', threshold=0.5)[ソース]#
ベースクラス:
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.- パラメータ:
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)[ソース]#
- パラメータ:
primary (SurrogateManager)
fallback (SurrogateManager)
metric (str)
threshold (float)
- 戻り値の型:
None
- ManagerSwitcher.switch(accuracy)[ソース]#
Return primary or fallback based on the metric threshold.
- パラメータ:
accuracy (SurrogateAccuracy | None)
- 戻り値の型: