comparison mlp.py @ 127:f959ad58facc

Automated merge with ssh://p-omega1@lgcm.iro.umontreal.ca/tlearn
author Yoshua Bengio <bengioy@iro.umontreal.ca>
date Wed, 07 May 2008 16:58:06 -0400
parents 4efe6d36c061
children 4c2280edcaf5
comparison
equal deleted inserted replaced
125:7d8b3d6dd4e9 127:f959ad58facc
69 self._n_hidden = n_hidden 69 self._n_hidden = n_hidden
70 self._init_range = init_range 70 self._init_range = init_range
71 self.learning_rate = learning_rate # this is the float 71 self.learning_rate = learning_rate # this is the float
72 self._learning_rate = t.scalar('learning_rate') # this is the symbol 72 self._learning_rate = t.scalar('learning_rate') # this is the symbol
73 self._input = t.matrix('input') # n_examples x n_inputs 73 self._input = t.matrix('input') # n_examples x n_inputs
74 self._target = t.matrix('target','int32') # n_examples x n_outputs 74 self._target = t.ivector('target') # n_examples x n_outputs
75 self._L2_regularizer = t.scalar('L2_regularizer') 75 self._L2_regularizer = t.scalar('L2_regularizer')
76 self._W1 = t.matrix('W1') 76 self._W1 = t.matrix('W1')
77 self._W2 = t.matrix('W2') 77 self._W2 = t.matrix('W2')
78 self._b1 = t.row('b1') 78 self._b1 = t.row('b1')
79 self._b2 = t.row('b2') 79 self._b2 = t.row('b2')
80 self._regularization_term = self._L2_regularizer * (t.dot(self._W1,self._W1) + t.dot(self._W2,self._W2)) 80 self._regularization_term = self._L2_regularizer * (t.sum(self._W1*self._W1) + t.sum(self._W2*self._W2))
81 self._output_activations =self._b2+t.dot(t.tanh(self._b1+t.dot(self._input,self._W1.T)),self._W2.T) 81 self._output_activations =self._b2+t.dot(t.tanh(self._b1+t.dot(self._input,self._W1.T)),self._W2.T)
82 self._nll,self._output = crossentropy_softmax_1hot(self._output_activations,self._target) 82 self._nll,self._output = crossentropy_softmax_1hot(self._output_activations,self._target)
83 self._output_class = t.argmax(self._output,1) 83 self._output_class = t.argmax(self._output,1)
84 self._class_error = self._output_class != self._target 84 self._class_error = self._output_class != self._target
85 self._minibatch_criterion = self._nll + self._regularization_term / t.shape(self._input)[0] 85 self._minibatch_criterion = self._nll + self._regularization_term / t.shape(self._input)[0]