Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/lazyprogrammer/machine_learning_examples
/ epsilon_greedy
Function
epsilon_greedy
rl/sarsa.py:20–25 ·
view source on GitHub ↗
(Q, s, eps=0.1)
Source
from the content-addressed store, hash-verified
18
19
20
def
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
28
if
__name__ ==
'__main__'
:
Callers
1
sarsa.py
File · 0.70
Calls
1
max_dict
Function · 0.90
Tested by
no test coverage detected