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

Method __contains__

numpy_ml/rl_models/rl_utils.py:58–63  ·  view source on GitHub ↗

True if EnvModel contains `key`, else False

(self, key)

Source from the content-addressed store, hash-verified

56 return self._model[(s, a)][(r, s_)]
57
58 def __contains__(self, key):
59 """True if EnvModel contains `key`, else False"""
60 s, a, r, s_ = key
61 p1 = (s, a) in self.state_action_pairs()
62 p2 = (r, s_) in self.reward_outcome_pairs()
63 return p1 and p2
64
65 def state_action_pairs(self):
66 """Return all (state, action) pairs in the environment model"""

Callers 1

_encode_keyMethod · 0.45

Calls 2

state_action_pairsMethod · 0.95
reward_outcome_pairsMethod · 0.95

Tested by

no test coverage detected