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

Function gather_samples

rl/approx_control.py:43–54  ·  view source on GitHub ↗
(grid, n_episodes=1000)

Source from the content-addressed store, hash-verified

41
42
43def gather_samples(grid, n_episodes=1000):
44 samples = []
45 for _ in range(n_episodes):
46 s = grid.reset()
47 while not grid.game_over():
48 a = np.random.choice(ALL_POSSIBLE_ACTIONS)
49 sa = merge_state_action(s, a)
50 samples.append(sa)
51
52 r = grid.move(a)
53 s = grid.current_state()
54 return samples
55
56
57class Model:

Callers 1

__init__Method · 0.70

Calls 5

merge_state_actionFunction · 0.85
resetMethod · 0.45
game_overMethod · 0.45
moveMethod · 0.45
current_stateMethod · 0.45

Tested by

no test coverage detected