hive.utils.experiment module

Implementation of a simple experiment class.

class hive.utils.experiment.Experiment(name, save_dir, saving_schedule)[source]

Bases: Registrable

Implementation of a simple experiment class.

Initializes an experiment object.

The experiment state is an exposed property of objects of this class. It can be used to keep track of objects that need to be saved to keep track of the experiment, but don’t fit in one of the standard categories. One example of this is the various schedules used in the Runner class.

Parameters
  • name (str) – Name of the experiment.

  • dir_name (str) – Absolute path to the directory to save/load the experiment.

  • saving_schedule (Schedule) – Schedule that determines when the experiment should be saved.

register_experiment(**kwargs)[source]

Registers all the components of an experiment.

Parameters
  • logger (Logger) – a logger object.

  • agents (Agent | list[Agent]) – either an agent object or a list of agents.

  • environment (BaseEnv) – an environment object.

register_config(config)[source]

Registers the experiment config.

Parameters

config (Chomp) – a config dictionary.

update_step()[source]

Updates the step of the saving schedule for the experiment.

should_save()[source]

Returns whether you should save the experiment at the current step.

save(tag='current')[source]

Saves the experiment. :param tag: Tag to prefix the folder. :type tag: str

is_resumable(tag='current')[source]

Returns true if the experiment is resumable.

Parameters

tag (str) – Tag for the saved experiment.

resume(tag='current')[source]

Resumes the experiment from a checkpoint.

Parameters

tag (str) – Tag for the saved experiment.

classmethod type_name()[source]
Returns

“experiment_manager”

hive.utils.experiment.save_component(component, prefix)[source]
hive.utils.experiment.load_component(component, prefix)[source]