baybe.utils.dataframe.add_noise_to_perturb_degenerate_rows

baybe.utils.dataframe.add_noise_to_perturb_degenerate_rows(df: DataFrame, noise_ratio: float = 0.001)[source]

Add noise to degenerate rows to make them numerically distinguishable.

Note that the dataframe is changed in-place and also returned. The dataframe is left untouched if no rows are degenerate.

Parameters:
  • df (DataFrame) – The dataframe to be modified.

  • noise_ratio (float) – The magnitude of generated uniform noise relative to the min-max range of values for each column.

Return type:

DataFrame

Returns:

The modified dataframe.

Raises:

TypeError – If the provided dataframe has non-numerical content.