baybe.utils.validation.preprocess_dataframe

baybe.utils.validation.preprocess_dataframe(df: DataFrame, /, searchspace: SearchSpace, objective: Objective | None = None, numerical_measurements_must_be_within_tolerance: bool = True)[source]

Preprocess an experimental dataframe by validating and normalizing its contents.

Checks that the dataframe contains all required columns for the given parameters/objective and adjusts their dtypes accordingly. No-op if dataframe preprocessing is disabled in the settings.

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

  • searchspace (SearchSpace) – The search space to validate the dataframe columns against.

  • objective (Optional[Objective]) – The objective to validate the dataframe columns against.

  • numerical_measurements_must_be_within_tolerance (bool) – See validate_parameter_input().

Return type:

DataFrame

Returns:

The preprocessed dataframe.