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

Method act

numpy_ml/rl_models/agents.py:1480–1497  ·  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

1478 self.episode_history = {"state_actions": [], "rewards": []}
1479
1480 def act(self, obs):
1481 r"""
1482 Execute the behavior policy--an :math:`\epsilon`-soft policy used to
1483 generate actions during training.
1484
1485 Parameters
1486 ----------
1487 obs : int, float, or :py:class:`ndarray <numpy.ndarray>` as returned by ``env.step(action)``
1488 An observation from the environment.
1489
1490 Returns
1491 -------
1492 action : int, float, or :py:class:`ndarray <numpy.ndarray>`
1493 An action sampled from the distribution over actions defined by the
1494 epsilon-soft policy.
1495 """ # noqa: E501
1496 s = self._obs2num[obs]
1497 return self.behavior_policy(s)
1498
1499 def _epsilon_soft_policy(self, s, a=None):
1500 """

Callers 1

_episodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected