mlos_core.util

Internal helper functions for mlos_core package.

Functions

compare_optional_dataframe(→ bool)

Compare DataFrames that may also be None.

compare_optional_series(→ bool)

Compare Series that may also be None.

config_to_series(→ pandas.Series)

Converts a ConfigSpace config to a Series.

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.compare_optional_dataframe(left: pandas.DataFrame | None, right: pandas.DataFrame | None) bool[source]

Compare DataFrames that may also be None.

Parameters:
Returns:

Compare the equality of two Optional[pd.DataFrame] objects

Return type:

bool

mlos_core.util.compare_optional_series(left: pandas.Series | None, right: pandas.Series | None) bool[source]

Compare Series that may also be None.

Parameters:
Returns:

Compare the equality of two Optional[pd.Series] objects

Return type:

bool

mlos_core.util.config_to_series(config: ConfigSpace.Configuration) pandas.Series[source]

Converts a ConfigSpace config to a Series.

Parameters:

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

Returns:

A Series, containing the config’s parameters.

Return type:

pandas.Series

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