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

Method _update_queue

numpy_ml/rl_models/agents.py:1620–1640  ·  view source on GitHub ↗

Update the priority queue by calculating the priority for (s, a) and inserting it into the queue if it exceeds a fixed (small) threshold. Parameters ---------- s : int as returned by `self._obs2num` The id for the state/observation a : in

(self, s, a)

Source from the content-addressed store, hash-verified

1618 self._simulate_behavior()
1619
1620 def _update_queue(self, s, a):
1621 """
1622 Update the priority queue by calculating the priority for (s, a) and
1623 inserting it into the queue if it exceeds a fixed (small) threshold.
1624
1625 Parameters
1626 ----------
1627 s : int as returned by `self._obs2num`
1628 The id for the state/observation
1629 a : int as returned by `self._action2num`
1630 The id for the action taken from state `s`
1631 """
1632 sweep_queue = self.derived_variables["sweep_queue"]
1633
1634 # TODO: what's a good threshold here?
1635 priority = self._calc_priority(s, a)
1636 if priority >= 0.001:
1637 if (s, a) in sweep_queue:
1638 sweep_queue[(s, a)] = max(priority, sweep_queue[(s, a)])
1639 else:
1640 sweep_queue[(s, a)] = priority
1641
1642 def _calc_priority(self, s, a):
1643 """

Callers 2

updateMethod · 0.95
_simulate_behaviorMethod · 0.95

Calls 1

_calc_priorityMethod · 0.95

Tested by

no test coverage detected