mlrl.testbed.runnables module¶
Author: Michael Rapp (michael.rapp.ml@gmail.com)
Provides base classes for programs that can be configured via command line arguments.
- class mlrl.testbed.runnables.Runnable¶
-
An abstract base class for all programs that can be configured via the command line API. The programs functionality is implemented by individual extensions that are applied to the runnable.
- class PredictionDatasetExtension(*dependencies: Extension)¶
Bases:
ExtensionAn extension that configures the functionality to predict for different datasets.
- configure_experiment(args: Namespace, experiment_builder: Builder, _: ExperimentMode)¶
See
mlrl.testbed.extensions.extension.Extension.configure_experiment()
- get_supported_modes() set[ExperimentMode]¶
See
mlrl.testbed.extensions.extension.Extension.get_supported_modes()
- configure_arguments(cli: CommandLineInterface, mode: Mode) tuple[set[Argument], set[Argument]]¶
Configures the command line interface according to the extensions applied to the runnable.
- Parameters:
cli – The command line interface to be configured
mode – The mode of operation
- Returns:
A set that contains the arguments that should be added to the command line interface according to the registered extensions, as well as a set that contains algorithmic arguments
- configure_batch_mode(cli: CommandLineInterface) BatchMode¶
Configures the batch mode according to the extensions applied to the runnable.
- Parameters:
cli – The command line interface to be configured
- configure_read_mode(cli: CommandLineInterface) ReadMode¶
Configures the read mode according to the extensions applied to the runnable.
- Parameters:
cli – The command line interface to be configured
- configure_run_mode(cli: CommandLineInterface) RunMode¶
Configures the run mode according to the extensions applied to the runnable.
- Parameters:
cli – The command line interface to be configured
- abstractmethod create_batch_config_file_factory() Callable[[str], ConfigFile]¶
Must be implemented by subclasses in order to create the factory that allows to create the configuration file that configures the batch of experiments to be run in batch mode.
- Returns:
The factory that has been created
- get_algorithmic_arguments(mode: ExperimentMode, known_args: Namespace) set[Argument]¶
May be overridden by subclasses in order to return the arguments for configuring algorithmic parameters that should be added to the command line API.
- Parameters:
mode – The mode of operation
known_args – The command line arguments specified by the user
- Returns:
A set that contains the arguments that should be added to the command line API
- get_extensions() list[Extension]¶
May be overridden by subclasses in order to return the extensions that should be applied to the runnable.
- Returns:
A set that contains the extensions to be applied to the runnable
- get_program_info() ProgramInfo | None¶
May be overridden by subclasses in order to provide information about the program to be printed via the command line argument ‘-v’ or ‘–version’.
- Returns:
A ProgramInfo or None, if no information is provided
- get_supported_extensions(mode: ExperimentMode) list[Extension]¶
Returns the extensions that should be applied to the runnable and support a given mode of operation.
- Parameters:
mode – The mode to be supported
- Returns:
A list that contains all extensions that should be applied to the runnable and support the given mode
- run(mode: Mode, control_arguments: set[Argument], algorithmic_arguments: set[Argument], args: Namespace)¶
Executes the runnable.
- Parameters:
mode – The mode of operation
control_arguments – The arguments that should be added to the command line interface for controlling mlrl-testbed’s behavior
algorithmic_arguments – The arguments that should be added to the command line interface for configuring the algorithm’s hyperparameters
args – The command line arguments specified by the user