MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / predict

Function predict

examples/DeepQNetwork/common.py:18–27  ·  view source on GitHub ↗

Map from observation to action, with 0.01 greedy.

(s)

Source from the content-addressed store, hash-verified

16
17def play_one_episode(env, func, render=False):
18 def predict(s):
19 """
20 Map from observation to action, with 0.01 greedy.
21 """
22 s = np.expand_dims(s, 0) # batch
23 act = func(s)[0][0].argmax()
24 if random.random() < 0.01:
25 spc = env.action_space
26 act = spc.sample()
27 return act
28
29 ob = env.reset()
30 sum_r = 0

Callers 1

play_one_episodeFunction · 0.70

Calls 1

sampleMethod · 0.80

Tested by

no test coverage detected