MCPcopy Index your code
hub / github.com/lazyprogrammer/machine_learning_examples / gather_samples

Function gather_samples

rl/approx_prediction.py:30–40  ·  view source on GitHub ↗
(grid, n_episodes=10000)

Source from the content-addressed store, hash-verified

28
29
30def gather_samples(grid, n_episodes=10000):
31 samples = []
32 for _ in range(n_episodes):
33 s = grid.reset()
34 samples.append(s)
35 while not grid.game_over():
36 a = np.random.choice(ALL_POSSIBLE_ACTIONS)
37 r = grid.move(a)
38 s = grid.current_state()
39 samples.append(s)
40 return samples
41
42
43class Model:

Callers 1

__init__Method · 0.70

Calls 4

resetMethod · 0.45
game_overMethod · 0.45
moveMethod · 0.45
current_stateMethod · 0.45

Tested by

no test coverage detected