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

Method sample_action

rl3/es_flappy.py:98–105  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

96 return softmax(Z.dot(self.W2) + self.b2)
97
98 def sample_action(self, x):
99 # assume input is a single state of size (D,)
100 # first make it (N, D) to fit ML conventions
101 X = np.atleast_2d(x)
102 P = self.forward(X)
103 p = P[0] # the first row
104 # return np.random.choice(len(p), p=p)
105 return np.argmax(p)
106
107 def get_params(self):
108 # return a flat array of parameters

Callers 1

reward_functionFunction · 0.95

Calls 1

forwardMethod · 0.95

Tested by

no test coverage detected