(self, x)
| 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) |
no test coverage detected