baybe.simulation.core.simulate_experiment¶
- baybe.simulation.core.simulate_experiment(campaign: Campaign, lookup: DataFrame | Callable | None = None, /, *, batch_size: int = 1, n_doe_iterations: int | None = None, initial_data: DataFrame | None = None, random_seed: int | None = None, impute_mode: Literal['error', 'worst', 'best', 'mean', 'random', 'ignore'] = 'error', noise_percent: float | None = None)[source]¶
Simulate a Bayesian optimization loop.
The most basic type of simulation. Runs a single execution of the loop either for a specified number of steps or until there are no more configurations left to be tested.
- Parameters:
campaign (
Campaign
) – The DOE setting to be simulated.lookup (
Union
[DataFrame
,Callable
,None
]) – The lookup used to close the loop, providing target values for the queried parameter settings. For details, seebaybe.simulation.lookup.look_up_targets()
.batch_size (
int
) – The number of recommendations to be queried per iteration.n_doe_iterations (
Optional
[int
]) – The number of iterations to run the design-of-experiments loop. If not specified, the simulation proceeds until there are no more testable configurations left.initial_data (
Optional
[DataFrame
]) – The initial measurement data to be ingested before starting the loop.random_seed (
Optional
[int
]) – An optional random seed to be used for the simulation.impute_mode (
Literal
['error'
,'worst'
,'best'
,'mean'
,'random'
,'ignore'
]) –Specifies how a missing lookup will be handled. For details, see
baybe.simulation.lookup.look_up_targets()
. In addition to the choices listed there, the following option is available:"ignore"
: The search space is stripped before recommendations are made so that unmeasured experiments will not be recommended.
noise_percent (
Optional
[float
]) – If notNone
, relative noise in percent ofnoise_percent
will be applied to the parameter measurements.
- Return type:
- Returns:
A dataframe ready for plotting, see the
Note
for details.- Raises:
TypeError – If a non-suitable lookup is chosen.
ValueError – If the impute mode
ignore
is chosen for non-dataframe lookup.ValueError – If a setup is provided that would run indefinitely.
Note
The returned dataframe contains the following columns:
Iteration
: Corresponds to the DOE iteration (starting at 0)Num_Experiments
: Corresponds to the running number of experiments performed (usually x-axis)for each target a column
{targetname}_IterBest
: Corresponds to the best result for that target at the respective iterationfor each target a column
{targetname}_CumBest
: Corresponds to the best result for that target up to including respective iterationfor each target a column
{targetname}_Measurements
: The individual measurements obtained for the respective target and iteration