baybe.utils.dataframe.add_parameter_noise

baybe.utils.dataframe.add_parameter_noise(data: pd.DataFrame, parameters: Iterable[Parameter], noise_type: Literal['absolute', 'relative_percent'] = 'absolute', noise_level: float = 1.0)[source]

Apply uniform noise to the parameter values of a recommendation frame.

The noise can be additive or multiplicative. This can be used to simulate experimental noise or imperfect user input containing numerical parameter values that differ from the recommendations. Note that the dataframe is changed in-place and also returned.

Parameters:
  • data (pd.DataFrame) – Output of the recommend function of a Campaign object, see baybe.campaign.Campaign.recommend().

  • parameters (Iterable[Parameter]) – The parameters for which the values shall be corrupted.

  • noise_type (Literal[‘absolute’, ‘relative_percent’]) – Defines whether the noise should be additive or multiplicative.

  • noise_level (float) – Level/magnitude of the noise. Must be provided as numerical value for noise type absolute and as percentage for noise type relative_percent.

Return type:

pd.DataFrame

Returns:

The modified dataframe.

Raises:

ValueError – If noise_type is neither absolute nor relative_percent.