mlrl.testbed.experiments.output.sinks package

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

Provides classes that allow to write output data to different sinks.

class mlrl.testbed.experiments.output.sinks.CsvFileSink(directory: Path, options: Options = <mlrl.util.options.Options object>, create_directory: bool = False)

Bases: TabularFileSink

Allows to write tabular output data to a CSV file.

COLUMN_MODEL_SIZE = 'Model size'
create_source(input_directory: Path) Source | None

Must be implemented by subclasses in order to create a Source that can read the data written to this sink.

Returns:

The Source that has been created or None, if no source is available

class mlrl.testbed.experiments.output.sinks.FileSink(directory: Path, suffix: str, options: Options = <mlrl.util.options.Options object>, create_directory: bool = False)

Bases: Sink, ABC

An abstract base class for all sinks that write output data to a file.

write_to_sink(state: ExperimentState, output_data: OutputData, **kwargs)

See mlrl.testbed.experiments.output.sinks.sink.Sink.write_to_sink()

class mlrl.testbed.experiments.output.sinks.LogSink(options: ~mlrl.util.options.Options = <mlrl.util.options.Options object>, source_factory: ~typing.Callable[[~pathlib.Path], ~mlrl.testbed.experiments.input.sources.source.Source] | None = None)

Bases: Sink

Allows to write textual output data to the log.

SourceFactory

alias of Callable[[Path], Source]

create_source(input_directory: Path) Source | None

Must be implemented by subclasses in order to create a Source that can read the data written to this sink.

Returns:

The Source that has been created or None, if no source is available

write_to_sink(state: ExperimentState, output_data: OutputData, **kwargs)

See mlrl.testbed.experiments.output.sinks.sink.Sink.write_to_sink()

class mlrl.testbed.experiments.output.sinks.PickleFileSink(directory: Path, options: Options = <mlrl.util.options.Options object>, create_directory: bool = False)

Bases: FileSink

Allows to write output data to a file by using Python’s pickle mechanism.

create_source(input_directory: Path) Source | None

Must be implemented by subclasses in order to create a Source that can read the data written to this sink.

Returns:

The Source that has been created or None, if no source is available

class mlrl.testbed.experiments.output.sinks.Sink(options: Options = <mlrl.util.options.Options object>)

Bases: ABC

An abstract base class for all sinks, output data may be written to.

abstractmethod create_source(input_directory: Path) Source | None

Must be implemented by subclasses in order to create a Source that can read the data written to this sink.

Returns:

The Source that has been created or None, if no source is available

abstractmethod write_to_sink(state: ExperimentState, output_data: OutputData, **kwargs)

Must be implemented by subclasses in order to write output data to the sink.

Parameters:
  • state – The state from which the output data has been generated

  • output_data – The output data that should be written to the sink

class mlrl.testbed.experiments.output.sinks.TextFileSink(directory: Path, options: Options = <mlrl.util.options.Options object>, create_directory: bool = False)

Bases: FileSink

Allows to write textual output data to a text file.

create_source(input_directory: Path) Source | None

Must be implemented by subclasses in order to create a Source that can read the data written to this sink.

Returns:

The Source that has been created or None, if no source is available

class mlrl.testbed.experiments.output.sinks.YamlFileSink(directory: Path, options: Options = <mlrl.util.options.Options object>, create_directory: bool = False)

Bases: FileSink

Allows to write structural output data to a YAML file.

create_source(input_directory: Path) Source | None

Must be implemented by subclasses in order to create a Source that can read the data written to this sink.

Returns:

The Source that has been created or None, if no source is available

Submodules