Experiment modules

baconian.core.experiment

For experiments, its functionality should include: 1. experiment and config set up 2. logging control 3. hyper-param tuning etc. 4. visualization 5. any related experiment utility …

class baconian.core.experiment.Experiment(name: str, agent: baconian.core.agent.Agent, env: baconian.core.core.Env, flow: baconian.core.flow.train_test_flow.Flow, tuner: baconian.core.tuner.Tuner = None, register_default_global_status=True)
INIT_STATUS = 'CREATED'
STATUS_LIST = ('CREATED', 'INITED', 'RUNNING', 'FINISHED', 'CORRUPTED')
TOTAL_AGENT_TEST_SAMPLE_COUNT()
TOTAL_AGENT_TRAIN_SAMPLE_COUNT()
TOTAL_AGENT_UPDATE_COUNT()
TOTAL_ENV_STEP_TEST_SAMPLE_COUNT()
TOTAL_ENV_STEP_TRAIN_SAMPLE_COUNT()
__init__(name: str, agent: baconian.core.agent.Agent, env: baconian.core.core.Env, flow: baconian.core.flow.train_test_flow.Flow, tuner: baconian.core.tuner.Tuner = None, register_default_global_status=True)
Parameters:
  • name (str) – name of experiment
  • agent (Agent) – agent of experiment
  • env (Env) – environment of experiment
  • flow (Flow) – control flow to experiment
  • tuner (Tuner) – hyper-parameter tuning method, currently in development
  • register_default_global_status (bool) – register info key and status into global status collection
init()

Create a new TensorFlow session, and set status to ‘INITED’.

required_key_dict = {}
run()

Run the experiment, and set status to ‘RUNNING’.

baconian.core.experiment_runner

baconian.core.experiment_runner.single_exp_runner(task_fn, auto_choose_gpu_flag=False, gpu_id: int = 0, seed=None, del_if_log_path_existed=False, **task_fn_kwargs)
Parameters:
  • task_fn (method) – task function defined bu users
  • auto_choose_gpu_flag (bool) – auto choose gpu, default False
  • gpu_id (int) – gpu id, default 0
  • seed (int) – seed generated by system time

:param del_if_log_path_existed:delete obsolete log file path if existed, by default False :type del_if_log_path_existed: bool :param task_fn_kwargs: :type task_fn_kwargs: :return: :rtype:

baconian.core.experiment_runner.duplicate_exp_runner(num, task_fn, auto_choose_gpu_flag=False, gpu_id: int = 0, seeds: list = None, del_if_log_path_existed=False, **task_fn_kwargs)
Parameters:
  • num (int) – the number of multiple experiments
  • task_fn (method) – task function, defined by users
  • auto_choose_gpu_flag (bool) – auto choose gpu, default False
  • gpu_id (int) – gpu id, default 0
  • seeds (list) – seeds generated by system time
  • del_if_log_path_existed (bool) – delete the existing log path, default False
  • task_fn_kwargs
Returns:

Return type: