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

Method sample_action

rl3/flappy2envs.py:92–99  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

90 return softmax(Z.dot(self.W2) + self.b2)
91
92 def sample_action(self, x):
93 # assume input is a single state of size (D,)
94 # first make it (N, D) to fit ML conventions
95 X = np.atleast_2d(x)
96 P = self.forward(X)
97 p = P[0] # the first row
98 # return np.random.choice(len(p), p=p)
99 return np.argmax(p)
100
101 def score(self, X, Y):
102 P = np.argmax(self.forward(X), axis=1)

Callers 1

reward_functionFunction · 0.95

Calls 1

forwardMethod · 0.95

Tested by

no test coverage detected