(greedy, s, eps=0.1)
| 18 | |
| 19 | |
| 20 | def epsilon_greedy(greedy, s, eps=0.1): |
| 21 | # we'll use epsilon-soft to ensure all states are visited |
| 22 | # what happens if you don't do this? i.e. eps=0 |
| 23 | p = np.random.random() |
| 24 | if p < (1 - eps): |
| 25 | return greedy[s] |
| 26 | else: |
| 27 | return np.random.choice(ALL_POSSIBLE_ACTIONS) |
| 28 | |
| 29 | |
| 30 | def gather_samples(grid, n_episodes=10000): |