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