MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / HiddenLayer

Class HiddenLayer

ann_class2/dropout_theano.py:35–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33
34
35class HiddenLayer(object):
36 def __init__(self, M1, M2, an_id):
37 self.id = an_id
38 self.M1 = M1
39 self.M2 = M2
40 W = np.random.randn(M1, M2) * np.sqrt(2.0 / M1)
41 b = np.zeros(M2)
42 self.W = theano.shared(W, 'W_%s' % self.id)
43 self.b = theano.shared(b, 'b_%s' % self.id)
44 self.params = [self.W, self.b]
45
46 def forward(self, X):
47 return T.nnet.relu(X.dot(self.W) + self.b)
48
49
50class ANN(object):

Callers 1

fitMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected