MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / sample_action

Method sample_action

rl2/cartpole/q_learning.py:87–91  ·  view source on GitHub ↗
(self, s, eps)

Source from the content-addressed store, hash-verified

85 self.models[a].partial_fit(X, [G])
86
87 def sample_action(self, s, eps):
88 if np.random.random() < eps:
89 return self.env.action_space.sample()
90 else:
91 return np.argmax(self.predict(s))
92
93
94def play_one(env, model, eps, gamma):

Callers 1

play_oneFunction · 0.45

Calls 2

predictMethod · 0.95
sampleMethod · 0.45

Tested by

no test coverage detected