baybe.parameters.utils.activate_parameter

baybe.parameters.utils.activate_parameter(parameter: NumericalContinuousParameter, thresholds: Interval)[source]

Force-activates a given parameter by moving its bounds away from zero.

A parameter is considered active if its value falls outside the specified threshold interval. Force-activating a parameter adjusts its range to ensure it cannot take values within this interval. Parameters that are inherently active, due to their original value ranges not overlapping with the inactivity interval, remain unchanged.

Important

A parameter whose range includes zero but extends beyond the threshold interval on both sides remains unchanged, because the corresponding activated parameter would no longer have a continuous value range.

Parameters:
Return type:

NumericalContinuousParameter

Returns:

A copy of the parameter with adjusted bounds.

Raises:
  • ValueError – If the threshold interval does not contain zero.

  • ValueError – If the parameter cannot be activated since both its bounds are in the inactive range.

  • NotImplementedError – In situations that cannot be encountered in a regular recommendation context since prevented by other validation measures (for example, edge case of an activation that would result in a single active point when the open inactive interval aligns on one side with the parameter bounds). For such situations, the behavior of the function is not defined.