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 modified in-place, and that no new dataframe is returned.
- Parameters:
data (pd.DataFrame) – Output of the
recommend
function of aCampaign
object, seebaybe.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 typerelative_percent
.
- Raises:
ValueError – If
noise_type
is neitherabsolute
norrelative_percent
.- Return type:
None