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

Method sample_action

rl2/cartpole/td_lambda.py:77–81  ·  view source on GitHub ↗
(self, s, eps)

Source from the content-addressed store, hash-verified

75 self.models[a].partial_fit(X[0], G, self.eligibilities[a])
76
77 def sample_action(self, s, eps):
78 if np.random.random() < eps:
79 return self.env.action_space.sample()
80 else:
81 return np.argmax(self.predict(s))
82
83
84# returns a list of states_and_rewards, and the total reward

Callers 1

play_oneFunction · 0.45

Calls 2

predictMethod · 0.95
sampleMethod · 0.45

Tested by

no test coverage detected