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

Method update

numpy_ml/rl_models/agents.py:1600–1618  ·  view source on GitHub ↗

Update the priority queue with the most recent (state, action) pair and perform random-sample one-step tabular Q-planning. Notes ----- The planning algorithm uses a priority queue to retrieve the state-action pairs from the agent's history which will

(self)

Source from the content-addressed store, hash-verified

1598 return out
1599
1600 def update(self):
1601 """
1602 Update the priority queue with the most recent (state, action) pair and
1603 perform random-sample one-step tabular Q-planning.
1604
1605 Notes
1606 -----
1607 The planning algorithm uses a priority queue to retrieve the
1608 state-action pairs from the agent's history which will result in the
1609 largest change to its `Q`-value if backed up. When the first pair in
1610 the queue is backed up, the effect on each of its predecessor pairs is
1611 computed. If the predecessor's priority is greater than a small
1612 threshold the pair is added to the queue and the process is repeated
1613 until either the queue is empty or we exceed `n_simulated_actions`
1614 updates.
1615 """
1616 s, a = self.episode_history["state_actions"][-1]
1617 self._update_queue(s, a)
1618 self._simulate_behavior()
1619
1620 def _update_queue(self, s, a):
1621 """

Callers 1

_episodeMethod · 0.95

Calls 2

_update_queueMethod · 0.95
_simulate_behaviorMethod · 0.95

Tested by

no test coverage detected