MCPcopy Index your code
hub / github.com/lisa-lab/DeepLearningTutorials / errors

Method errors

code/logistic_sgd.py:150–172  ·  view source on GitHub ↗

Return a float representing the number of errors in the minibatch over the total number of examples of the minibatch ; zero one loss over the size of the minibatch :type y: theano.tensor.TensorType :param y: corresponds to a vector that gives for each example the

(self, y)

Source from the content-addressed store, hash-verified

148 # end-snippet-2
149
150 def errors(self, y):
151 """Return a float representing the number of errors in the minibatch
152 over the total number of examples of the minibatch ; zero one
153 loss over the size of the minibatch
154
155 :type y: theano.tensor.TensorType
156 :param y: corresponds to a vector that gives for each example the
157 correct label
158 """
159
160 # check if y has same dimension of y_pred
161 if y.ndim != self.y_pred.ndim:
162 raise TypeError(
163 'y should have the same shape as self.y_pred',
164 ('y', y.type, 'y_pred', self.y_pred.type)
165 )
166 # check if y is of the correct datatype
167 if y.dtype.startswith('int'):
168 # the T.neq operator returns a vector of 0s and 1s, where 1
169 # represents a mistake in prediction
170 return T.mean(T.neq(self.y_pred, y))
171 else:
172 raise NotImplementedError()
173
174
175def load_data(dataset):

Callers 1

sgd_optimization_mnistFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected