Policy¶
-
class
Policy
(feature_dim: int, action_space: gym.spaces.space.Space, **params)¶ Bases:
pandemonium.utilities.registrable.Registrable
Base abstract class for decision making rules
A policy is a function \(\pi: \mathcal{X} \mapsto \mathcal{A}\) that maps from the space of features onto the space of actions.
Methods Summary
__call__
(self, \*args, \*\*kwargs)Call self as a function.
act
(self, \*args, \*\*kwargs)Samples an action from a distribution over actions
action_filter
(self, state)Filters the actions available at a given state
dist
(self, \*args, \*\*kwargs)Produces a distribution over actions
Methods Documentation
-
__call__
(self, \*args, \*\*kwargs)¶ Call self as a function.
-
act
(self, \*args, \*\*kwargs) → Tuple[ForwardRef(‘Action’), Dict[str, torch.distributions.distribution.Distribution]]¶ Samples an action from a distribution over actions
-
action_filter
(self, state)¶ Filters the actions available at a given state
Closely relates to option initiation sets:
>>> [o for o in options if o.initiation(state) == 1]
See also
Interest Functions by K. Khetarpal et al. 2020 https://arxiv.org/pdf/2001.00271.pdf
See also
Ray RLlib has a working implementation https://ray.readthedocs.io/en/latest/rllib-models.html#variable-length-parametric-action-spaces
-
dist
(self, \*args, \*\*kwargs) → torch.distributions.distribution.Distribution¶ Produces a distribution over actions
-