mlrl.testbed.experiments.output.data module

Author Michael Rapp (michael.rapp.ml@gmail.com)

Provides classes for representing output data.

class mlrl.testbed.experiments.output.data.DatasetOutputData(properties: Properties, context: Context = Context(include_dataset_type=True, include_prediction_scope=True, include_fold=True))

Bases: TextualOutputData, ABC

An abstract base class for all classes that represent output data that can be converted into a textual representation, as well as a dataset.

abstractmethod to_dataset(options: Options, **kwargs) Any | None

Creates and returns a dataset from the object.

Parameters:

options – Options to be taken into account

Returns:

The dataset

class mlrl.testbed.experiments.output.data.ObjectOutputData(properties: Properties, context: Context = Context(include_dataset_type=True, include_prediction_scope=True, include_fold=True))

Bases: OutputData, ABC

An abstract base class for all classes that represent output data that can be converted into a Python object.

abstractmethod to_object(options: Options, **kwargs) Any | None

Returns an object.

Parameters:

options – Options to be taken into account

Returns:

The object

class mlrl.testbed.experiments.output.data.OutputData(properties: Properties, context: Context = Context(include_dataset_type=True, include_prediction_scope=True, include_fold=True))

Bases: ABC

An abstract class for all classes that represent output data.

custom_context: dict[type[Any], Context]
get_context(lookup_type: type[Any]) Context

Returns a Context that can be used for finding a suitable sink for handling this data.

Parameters:

lookup_type – The type of the sink to search for

Returns:

A Context

class mlrl.testbed.experiments.output.data.OutputValue(option_key: str, name: str, percentage: bool = False)

Bases: object

Represents a numeric value that is part of output data.

COLUMN_PREFIX_STD_DEV = 'Std.-dev.'
static filter_values(values: Iterable[OutputValue], options: Options) list[OutputValue]

Allows to filter given output values based on given options.

Parameters:
  • values – The output values to be filtered

  • options – Options that should be used for filtering

Returns:

A list that contains the filtered output values

format(value, **kwargs) str

Creates and returns a textual representation of a given value.

Parameters:

value – The value

Returns:

The textual representation that has been created

std_dev() OutputValue

Creates and returns an OutputValue that corresponds to the standard deviation of this value.

Returns:

An OutputValue that corresponds to the standard deviation of this value

class mlrl.testbed.experiments.output.data.StructuralOutputData(properties: Properties, context: Context = Context(include_dataset_type=True, include_prediction_scope=True, include_fold=True))

Bases: TextualOutputData, ABC

An abstract base class for all classes that represent output data that can be converted into a structural representation, e.g., YAML or JSON.

abstractmethod to_dict(options: Options, **kwargs) dict[Any, Any] | None

Creates and returns a dictionary from the object.

Parameters:

options – Options to be taken into account

Returns:

The dictionary that has been created

to_text(options: Options, **kwargs) str | None

Creates and returns a textual representation of the object.

Parameters:

options – Options to be taken into account

Returns:

The textual representation that has been created

class mlrl.testbed.experiments.output.data.TabularOutputData(properties: TabularProperties, context: Context = Context(include_dataset_type=True, include_prediction_scope=True, include_fold=True))

Bases: TextualOutputData, ABC

An abstract class for all classes that represent output data that can be converted into a textual, as well as a tabular, representation.

static from_table(properties: TabularProperties, context: Context, table: Table) TabularOutputData

Creates and returns TabularOutputData from a given table.

Parameters:
  • properties – The properties to be used

  • context – The context to be used

  • table – The table to be used

Returns:

The TabularOutputData that has been created

abstractmethod to_table(options: Options, **kwargs) Table | None

Creates and returns a tabular representation of the object.

Parameters:

options – Options to be taken into account

Returns:

The tabular representation that has been created

class mlrl.testbed.experiments.output.data.TextualOutputData(properties: Properties, context: Context = Context(include_dataset_type=True, include_prediction_scope=True, include_fold=True))

Bases: OutputData, ABC

An abstract class for all classes that represent output data that can be converted into a textual representation.

class Title(title: str, context: Context)

Bases: object

A title that is printed before textual output data.

format(state: ExperimentState) str

Formats and returns the title that is printed before the output data.

Parameters:

state – The state from which the output data has been generated

static from_text(properties: Properties, context: Context, text: str) TextualOutputData

Creates and returns TextualOutputData from a given text.

Parameters:
  • properties – The properties to be used

  • context – The context to be used

  • text – The text to be used

Returns:

The TextualOutputData that has been created

abstractmethod to_text(options: Options, **kwargs) str | None

Creates and returns a textual representation of the object.

Parameters:

options – Options to be taken into account

Returns:

The textual representation that has been created