Mercurial > pylearn
diff mlp.py @ 126:4efe6d36c061
minor edits
author | Yoshua Bengio <bengioy@iro.umontreal.ca> |
---|---|
date | Wed, 07 May 2008 16:57:48 -0400 |
parents | 2ca8dccba270 |
children | 4c2280edcaf5 |
line wrap: on
line diff
--- a/mlp.py Wed May 07 16:08:18 2008 -0400 +++ b/mlp.py Wed May 07 16:57:48 2008 -0400 @@ -71,13 +71,13 @@ self.learning_rate = learning_rate # this is the float self._learning_rate = t.scalar('learning_rate') # this is the symbol self._input = t.matrix('input') # n_examples x n_inputs - self._target = t.matrix('target','int32') # n_examples x n_outputs + self._target = t.ivector('target') # n_examples x n_outputs self._L2_regularizer = t.scalar('L2_regularizer') self._W1 = t.matrix('W1') self._W2 = t.matrix('W2') self._b1 = t.row('b1') self._b2 = t.row('b2') - self._regularization_term = self._L2_regularizer * (t.dot(self._W1,self._W1) + t.dot(self._W2,self._W2)) + self._regularization_term = self._L2_regularizer * (t.sum(self._W1*self._W1) + t.sum(self._W2*self._W2)) self._output_activations =self._b2+t.dot(t.tanh(self._b1+t.dot(self._input,self._W1.T)),self._W2.T) self._nll,self._output = crossentropy_softmax_1hot(self._output_activations,self._target) self._output_class = t.argmax(self._output,1)