cave.utils.helpers module

exception cave.utils.helpers.MissingInstancesError[source]

Bases: Exception

Exception indicating that instances are missing.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception cave.utils.helpers.NotApplicableError[source]

Bases: Exception

Exception indicating that this analysis-method cannot be performed.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

cave.utils.helpers.combine_runhistories(rhs, logger=None)[source]

Combine list of given runhistories. interleaving to best approximate execution order

cave.utils.helpers.escape_parameter_name(p)[source]

Necessary because: 1. parameters called ‘size’ or ‘origin’ might exist in cs 2. ‘-‘ not allowed in bokeh’s CDS

cave.utils.helpers.get_config_origin(c)[source]

Return appropriate configuration origin

Parameters:c (Configuration) – configuration to be examined
Returns:origin – origin of configuration (e.g. “Local”, “Random”, etc.)
Return type:str
cave.utils.helpers.get_cost_dict_for_config(rh: smac.runhistory.runhistory.RunHistory, conf: ConfigSpace.configuration_space.Configuration, par: int = 1, cutoff: Optional[float] = None)[source]

Aggregates loss for configuration on evaluated instances over seeds.

Parameters:
  • rh (RunHistory) – runhistory with data
  • conf (Configuration) – configuration to evaluate
  • par (int) – par-factor with which to multiply timeouts
  • cutoff (float) – cutoff of scenario - used to penalize costs if par != 1
Returns:

cost – cost per instance (aggregated or as list per seed)

Return type:

dict(instance->cost)

cave.utils.helpers.get_timeout(rh, conf, cutoff)[source]

Check for timeouts. If multiple runs for an inst/config-pair are available, using the median (not the mean: no fractional timeouts)

Parameters:
  • rh (RunHistory) – runhistory to take runs from
  • conf (Configuration) – config to use
  • cutoff (int) – to determine timeouts
Returns:

timeouts – mapping instances to [True, False], where True indicates a timeout

Return type:

Dict(str: bool)

cave.utils.helpers.scenario_sanity_check(s, logger)[source]

Check scenario for number of train- and test-instances, (duplicate) features and inconsistencies. Logs information and raises ValueError if train-features available, but test-features not.