mlos_core.util

Internal helper functions for mlos_core package.

Functions

config_to_dataframe(→ pandas.DataFrame)

Converts a ConfigSpace config to a DataFrame.

drop_nulls(→ dict)

Remove all key-value pairs where the value is None.

normalize_config(→ ConfigSpace.Configuration)

Convert a dictionary to a valid ConfigSpace configuration.

Module Contents

mlos_core.util.config_to_dataframe(config: ConfigSpace.Configuration) pandas.DataFrame[source]

Converts a ConfigSpace config to a DataFrame.

Parameters:

config (ConfigSpace.Configuration) – The config to convert.

Returns:

A DataFrame with a single row, containing the config’s parameters.

Return type:

pandas.DataFrame

mlos_core.util.drop_nulls(d: dict) dict[source]

Remove all key-value pairs where the value is None.

Parameters:

d (dict) – The dictionary to clean.

Returns:

The cleaned dictionary.

Return type:

dict

mlos_core.util.normalize_config(config_space: ConfigSpace.ConfigurationSpace, config: ConfigSpace.Configuration | dict) ConfigSpace.Configuration[source]

Convert a dictionary to a valid ConfigSpace configuration.

Some optimizers and adapters ignore ConfigSpace conditionals when proposing new configurations. We have to manually remove inactive hyperparameters such suggestions.

Parameters:
Returns:

cs_config – A valid ConfigSpace configuration with inactive parameters removed.

Return type:

ConfigSpace.Configuration