mlos_core.util
Internal helper functions for mlos_core package.
Functions
|
Compare DataFrames that may also be None. |
|
Compare Series that may also be None. |
|
Converts a ConfigSpace config to a Series. |
|
Remove all key-value pairs where the value is None. |
|
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:
left (Optional[pandas.DataFrame]) – The left DataFrame to compare
right (Optional[pandas.DataFrame]) – The right DataFrame to compare
- Returns:
Compare the equality of two Optional[pd.DataFrame] objects
- Return type:
- mlos_core.util.compare_optional_series(left: pandas.Series | None, right: pandas.Series | None) bool [source]
Compare Series that may also be None.
- Parameters:
left (Optional[pandas.Series]) – The left Series to compare
right (Optional[pandas.Series]) – The right Series to compare
- Returns:
Compare the equality of two Optional[pd.Series] objects
- Return type:
- 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:
- mlos_core.util.drop_nulls(d: dict) dict [source]
Remove all key-value pairs where the value is None.
- 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:
config_space (ConfigSpace.ConfigurationSpace) – The parameter space to use.
config (dict) – The configuration to convert.
- Returns:
cs_config – A valid ConfigSpace configuration with inactive parameters removed.
- Return type: