hive.utils.experiment module

Implementation of a simple experiment class.

class hive.utils.experiment.Experiment(name, dir_name, schedule)[source]

Bases: object

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.

register_experiment(config=None, logger=None, agents=None, environment=None)[source]

Registers all the components of an experiment.

Parameters
  • config (Chomp) – a config dictionary.

  • logger (Logger) – a logger object.

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

  • environment (BaseEnv) – an environment object.

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.