MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / epsilon_greedy

Function epsilon_greedy

rl/q_learning.py:20–25  ·  view source on GitHub ↗
(Q, s, eps=0.1)

Source from the content-addressed store, hash-verified

18
19
20def epsilon_greedy(Q, s, eps=0.1):
21 if np.random.random() < eps:
22 return np.random.choice(ALL_POSSIBLE_ACTIONS)
23 else:
24 a_opt = max_dict(Q[s])[0]
25 return a_opt
26
27
28if __name__ == '__main__':

Callers 1

q_learning.pyFile · 0.70

Calls 1

max_dictFunction · 0.90

Tested by

no test coverage detected