Experiment#

The module tsl.experiment contains classes and utilities for experiment pipelining, scalability and reproducibility. The main class in the package is tsl.experiment.Experiment and relies on Hydra for managing configurations.

Experiment#

class Experiment(run_fn: Callable, config_path: Optional[str] = None, config_name: Optional[str] = None, pre_run_hooks: Optional[Union[Callable, List[Callable]]] = None)[source]#

Simple class to handle the routines used to run experiments.

This class relies heavily on the Hydra framework, check Hydra docs for usage information.

Hydra is an optional dependency of tsl, to install it using pip:

pip install hydra-core
Parameters:
  • run_fn (callable) – Python function that actually runs the experiment when called. The run function must accept a single argument, being the experiment configuration.

  • config_path (str, optional) – Path to configuration files. If not specified the default will be used.

  • config_name (str, optional) – Name of the configuration file in config_path to be used. The yaml extension can be omitted.

  • pre_run_hooks (list) – Ordered list of functions to call on run() before the run_fn. Every hook must accept a single argument, being the experiment configuration, and act in-place on the configuration.

property run_dir#

Directory of the current run, where logs and artifacts are stored.

log_config() None[source]#

Save config as .yaml file in run_dir().

run()[source]#

Run the experiment routine.