| 16 | |
| 17 | |
| 18 | class HiddenLayer(object): |
| 19 | def __init__(self, D, M): |
| 20 | W = init_weights((D, M)) |
| 21 | b = np.zeros(M, dtype=np.float32) |
| 22 | self.W = theano.shared(W) |
| 23 | self.b = theano.shared(b) |
| 24 | self.params = [self.W, self.b] |
| 25 | |
| 26 | def forward(self, X): |
| 27 | # we want to use the sigmoid so we can observe |
| 28 | # the vanishing gradient! |
| 29 | return T.nnet.sigmoid(X.dot(self.W) + self.b) |
| 30 | |
| 31 | |
| 32 | class ANN(object): |