malib.rl.random package

Submodules

malib.rl.random.config module

malib.rl.random.policy module

class malib.rl.random.policy.RandomPolicy(observation_space: Space, action_space: Space, model_config: Dict[str, Any], custom_config: Dict[str, Any], **kwargs)[source]

Bases: PGPolicy

Build a REINFORCE policy whose input and output dims are determined by observation_space and action_space, respectively.

Parameters:
  • observation_space (spaces.Space) – The observation space.

  • action_space (spaces.Space) – The action space.

  • model_config (Dict[str, Any]) – The model configuration dict.

  • custom_config (Dict[str, Any]) – The custom configuration dict.

  • is_fixed (bool, optional) – Indicates fixed policy or trainable policy. Defaults to False.

Raises:
  • NotImplementedError – Does not support other action space type settings except Box and Discrete.

  • TypeError – Unexpected action space.

malib.rl.random.random_trainer module

class malib.rl.random.random_trainer.RandomTrainer(training_config: Dict[str, Any], policy_instance: Optional[Policy] = None)[source]

Bases: PGTrainer

Initialize a trainer for a type of policies.

Parameters:
  • learning_mode (str) – Learning mode inidication, could be off_policy or on_policy.

  • training_config (Dict[str, Any], optional) – The training configuration. Defaults to None.

  • policy_instance (Policy, optional) – A policy instance, if None, we must reset it. Defaults to None.