mlos_core.data_classes
Data classes for mlos_core used to pass around configurations, observations, and
suggestions.
mlos_core uses pandas DataFrame
s and Series to represent configurations and scores and
context (information about where the configuration was evaluated).
These modules encapsulate tuples of those for easier passing around and manipulation.
Classes
A single observation of a configuration.  | 
|
A set of observations of a configuration scores.  | 
|
A single suggestion for a configuration.  | 
Module Contents
- class mlos_core.data_classes.Observation(*, config: pandas.Series, score: pandas.Series = pd.Series(), context: pandas.Series | None = None, metadata: pandas.Series | None = None)[source]
 A single observation of a configuration.
Creates a new Observation object.
- Parameters:
 config (pandas.Series) – The configuration observed.
score (pandas.Series) – The score metrics observed.
context (pandas.Series | None) – The context in which the configuration was evaluated. Not Yet Implemented.
metadata (pandas.Series | None) – The metadata in which the configuration was evaluated
- to_suggestion() Suggestion[source]
 Converts the observation to a suggestion.
- Returns:
 The suggestion.
- Return type:
 
- property config: pandas.Series[source]
 Gets (a copy of) the config of the Observation.
- Return type:
 
- property context: pandas.Series | None[source]
 Gets (a copy of) the context of the Observation.
- Return type:
 pandas.Series | None
- property metadata: pandas.Series | None[source]
 Gets (a copy of) the metadata of the Observation.
- Return type:
 pandas.Series | None
- property score: pandas.Series[source]
 Gets (a copy of) the score of the Observation.
- Return type:
 
- class mlos_core.data_classes.Observations(*, configs: pandas.DataFrame = pd.DataFrame(), scores: pandas.DataFrame = pd.DataFrame(), contexts: pandas.DataFrame | None = None, metadata: pandas.DataFrame | None = None, observations: collections.abc.Iterable[Observation] | None = None)[source]
 A set of observations of a configuration scores.
Creates a new Observation object.
Can accept either a set of Observations or a collection of aligned config and score (and optionally context) dataframes.
If both are provided the two sets will be merged.
- Parameters:
 configs (pandas.DataFrame) – Pandas dataframe containing configurations. Column names are the parameter names.
scores (pandas.DataFrame) – The score metrics observed in a dataframe.
contexts (pandas.DataFrame | None) – The context in which the configuration was evaluated. Not Yet Implemented.
metadata (pandas.DataFrame | None) – The metadata in which the configuration was evaluated Not Yet Implemented.
observations (collections.abc.Iterable[Observation] | None)
- __iter__() collections.abc.Iterator[Observation][source]
 - Return type:
 
- append(observation: Observation) None[source]
 Appends the given observation to this observation.
- Parameters:
 observation (Observation) – The observation to append.
- Return type:
 None
- filter_by_index(index: pandas.Index) Observations[source]
 Filters the observation by the given indices.
- Parameters:
 index (pandas.Index) – The indices to filter by.
- Returns:
 The filtered observation.
- Return type:
 
- property configs: pandas.DataFrame[source]
 Gets a copy of the configs of the Observations.
- Return type:
 
- property contexts: pandas.DataFrame | None[source]
 Gets a copy of the contexts of the Observations.
- Return type:
 pandas.DataFrame | None
- property metadata: pandas.DataFrame | None[source]
 Gets a copy of the metadata of the Observations.
- Return type:
 pandas.DataFrame | None
- property scores: pandas.DataFrame[source]
 Gets a copy of the scores of the Observations.
- Return type:
 
- class mlos_core.data_classes.Suggestion(*, config: pandas.Series, context: pandas.Series | None = None, metadata: pandas.Series | None = None)[source]
 A single suggestion for a configuration.
A Suggestion is an Observation that has not yet been scored. Evaluating the Suggestion and calling complete(scores) can convert it to an Observation.
Creates a new Suggestion.
- Parameters:
 config (pandas.Series) – The configuration suggested.
context (pandas.Series | None) – The context for this suggestion, by default None
metadata (pandas.Series | None) – Any metadata provided by the underlying optimizer, by default None
- complete(score: pandas.Series) Observation[source]
 Completes the Suggestion by adding a score to turn it into an Observation.
- Parameters:
 score (pandas.Series) – The score metrics observed.
- Returns:
 The observation of the suggestion.
- Return type:
 
- to_configspace_config(space: ConfigSpace.ConfigurationSpace) ConfigSpace.Configuration[source]
 Convert a Configuration Space to a Configuration.
- Parameters:
 space (ConfigSpace.ConfigurationSpace) – The ConfigurationSpace to be converted.
- Returns:
 The output Configuration.
- Return type:
 
- property config: pandas.Series[source]
 Gets (a copy of) the config of the Suggestion.
- Return type:
 
- property context: pandas.Series | None[source]
 Gets (a copy of) the context of the Suggestion.
- Return type:
 pandas.Series | None
- property metadata: pandas.Series | None[source]
 Gets (a copy of) the metadata of the Suggestion.
- Return type:
 pandas.Series | None