multiml.agent.BaseAgent

class multiml.agent.BaseAgent(saver=None, storegate=None, task_scheduler=None, metric=None, metric_args=None)

Base class of agent.

All agent class need to inherit this BaseAgent class.

__init__(saver=None, storegate=None, task_scheduler=None, metric=None, metric_args=None)

Initialize base agent.

Parameters:
  • saver (Saver or str) – Saver class instance. If saver is None, Saver class instance is created without any args. If If saver is str, Saver` class instance is created with given save_dir.

  • storegate (StoreGate or dict) – StoreGate class instance. If dict is given, StoreGate class instance is created with given dict args.

  • task_scheduler (TaskScheduler or list) – TaskScheduler class instance. If ordered tasks (list) are given, TaskScheduler is initialized with ordered tasks. Please see TaskScheduler class for details.

  • metric (str or BaseMetric) – str or Metric class instance. If str is given, Metric class is searched from multiml.agent.metric, and initialized with metric_args below.

  • metric_args (dict) – arbitrary args of Metric class. This option is valid only if metric is str.

Methods

__init__([saver, storegate, task_scheduler, ...])

Initialize base agent.

execute()

Execute base agent.

execute_finalize()

Execute and finalize base agent.

finalize()

Finalize base agent.

Attributes

metric

Return metric of base agent.

saver

Return saver of base agent.

storegate

Return storegate of base agent.

task_scheduler

Return task_scheduler of base agent.

__init__(saver=None, storegate=None, task_scheduler=None, metric=None, metric_args=None)

Initialize base agent.

Parameters:
  • saver (Saver or str) – Saver class instance. If saver is None, Saver class instance is created without any args. If If saver is str, Saver` class instance is created with given save_dir.

  • storegate (StoreGate or dict) – StoreGate class instance. If dict is given, StoreGate class instance is created with given dict args.

  • task_scheduler (TaskScheduler or list) – TaskScheduler class instance. If ordered tasks (list) are given, TaskScheduler is initialized with ordered tasks. Please see TaskScheduler class for details.

  • metric (str or BaseMetric) – str or Metric class instance. If str is given, Metric class is searched from multiml.agent.metric, and initialized with metric_args below.

  • metric_args (dict) – arbitrary args of Metric class. This option is valid only if metric is str.