rlberry.manager.MultipleManagers

class rlberry.manager.MultipleManagers(max_workers: int | None = None, parallelization: str = 'process', mp_context='spawn')[source]

Bases: object

Class to fit multiple ExperimentManager instances in parallel with multiple threads.

Parameters:
max_workers: int, default=None

max number of workers (ExperimentManager instances) fitted at the same time.

parallelization: {‘thread’, ‘process’}, default: ‘process’

Whether to parallelize agent training using threads or processes.

mp_context: {‘spawn’, ‘fork’, ‘forkserver’}, default: ‘spawn’.

Context for python multiprocessing module. Warning: If you’re using JAX or PyTorch, it only works with ‘spawn’.

If running code on a notebook or interpreter, use ‘fork’.

Attributes:
managers

Methods

append(experiment_manager)

Append new ExperimentManager instance.

run([save])

Fit ExperimentManager instances in parallel.

save()

Pickle ExperimentManager instances and saves fit statistics in .csv files.

append(experiment_manager)[source]

Append new ExperimentManager instance.

Parameters:
experiment_managerExperimentManager
run(save=True)[source]

Fit ExperimentManager instances in parallel.

Parameters:
save: bool, default: True

If true, save ExperimentManager intances immediately after fitting. ExperimentManager.save() is called.

save()[source]

Pickle ExperimentManager instances and saves fit statistics in .csv files. The output folder is defined in each of the ExperimentManager instances.