syne_tune.blackbox_repository.blackbox_offline module

class syne_tune.blackbox_repository.blackbox_offline.BlackboxOffline(df_evaluations, configuration_space, fidelity_space=None, objectives_names=None, seed_col=None)[source]

Bases: Blackbox

A blackbox obtained given offline evaluations. Each row of the dataframe should contain one evaluation given a fixed configuration, fidelity and seed. The columns must correspond to the provided configuration and fidelity space, by default all columns that are prefixed by "metric_" are assumed to be metrics but this can be overridden by providing metric columns.

Additional arguments on top of parent class Blackbox:

Parameters:
  • df_evaluations (DataFrame) – Data frame with evaluations data

  • seed_col (Optional[str]) – optional, can be used when multiple seeds are recorded

hyperparameter_objectives_values(predict_curves=False)[source]

If predict_curves is False, the shape of X is (num_evals * num_seeds * num_fidelities, num_hps + 1), the shape of y is (num_evals * num_seeds * num_fidelities, num_objectives). This can be reshaped to (num_fidelities, num_seeds, num_evals, *). The final column of X is the fidelity value (only a single fidelity attribute is supported).

If predict_curves is True, the shape of X is (num_evals * num_seeds, num_hps), the shape of y is (num_evals * num_seeds, num_fidelities * num_objectives). The latter can be reshaped to (num_seeds, num_evals, num_fidelities, num_objectives).

Returns:

a tuple of two dataframes (X, y), where X contains hyperparameters values and y contains objective values, this is used when fitting a surrogate model.

syne_tune.blackbox_repository.blackbox_offline.serialize(bb_dict, path, categorical_cols=[])[source]
Parameters:
  • bb_dict (Dict[str, BlackboxOffline]) –

  • path (str) –

  • categorical_cols (List[str]) – optional, allow to retrieve columns as categories, lower drastically the memory footprint when few values are present

Returns:

syne_tune.blackbox_repository.blackbox_offline.deserialize(path)[source]
Parameters:
  • path (str) – where to find blackbox serialized information (at least data.csv.zip and configspace.json)

  • groupby_col – separate evaluations into a list of blackbox with different task if the column is provided

Return type:

Union[Dict[str, BlackboxOffline], BlackboxOffline]

Returns:

list of blackboxes per task, or single blackbox in the case of a single task