MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / act

Method act

numpy_ml/rl_models/agents.py:642–659  ·  view source on GitHub ↗

r""" Execute the behavior policy--an :math:`\epsilon`-soft policy used to generate actions during training. Parameters ---------- obs : int, float, or :py:class:`ndarray ` as returned by ``env.step(action)`` An observation from the

(self, obs)

Source from the content-addressed store, hash-verified

640 break
641
642 def act(self, obs):
643 r"""
644 Execute the behavior policy--an :math:`\epsilon`-soft policy used to
645 generate actions during training.
646
647 Parameters
648 ----------
649 obs : int, float, or :py:class:`ndarray <numpy.ndarray>` as returned by ``env.step(action)``
650 An observation from the environment.
651
652 Returns
653 -------
654 action : int, float, or :py:class:`ndarray <numpy.ndarray>`
655 An action sampled from the distribution over actions defined by the
656 epsilon-soft policy.
657 """ # noqa: E501
658 s = self._obs2num[obs]
659 return self.behavior_policy(s)
660
661 def run_episode(self, max_steps, render=False):
662 """

Callers 1

_episodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected