(model, s, eps=0.1)
| 21 | |
| 22 | |
| 23 | def epsilon_greedy(model, s, eps=0.1): |
| 24 | # we'll use epsilon-soft to ensure all states are visited |
| 25 | # what happens if you don't do this? i.e. eps=0 |
| 26 | p = np.random.random() |
| 27 | if p < (1 - eps): |
| 28 | values = model.predict_all_actions(s) |
| 29 | return ALL_POSSIBLE_ACTIONS[np.argmax(values)] |
| 30 | else: |
| 31 | return np.random.choice(ALL_POSSIBLE_ACTIONS) |
| 32 | |
| 33 | |
| 34 | def one_hot(k): |
no test coverage detected