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 primary when metric >= threshold, fallback otherwise, 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

__init__

contract

Return the manager-switcher contract.

switch

Return primary or fallback based on the metric threshold.

Method Details

ManagerSwitcher.__init__(primary, fallback, *, metric='spearman', threshold=0.5)[ソース]#
パラメータ:
戻り値の型:

None

ManagerSwitcher.contract()[ソース]#

Return the manager-switcher contract.

戻り値の型:

ComponentContract

ManagerSwitcher.switch(accuracy)[ソース]#

Return primary or fallback based on the metric threshold.

パラメータ:

accuracy (SurrogateAccuracy | None)

戻り値の型:

SurrogateManager