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

Method errors

code/logistic_cg.py:121–142  ·  view source on GitHub ↗

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

(self, y)

Source from the content-addressed store, hash-verified

119 return -T.mean(T.log(self.p_y_given_x)[T.arange(y.shape[0]), y])
120
121 def errors(self, y):
122 """Return a float representing the number of errors in the minibatch
123 over the total number of examples of the minibatch
124
125 :type y: theano.tensor.TensorType
126 :param y: corresponds to a vector that gives for each example
127 the correct label
128 """
129
130 # check if y has same dimension of y_pred
131 if y.ndim != self.y_pred.ndim:
132 raise TypeError(
133 'y should have the same shape as self.y_pred',
134 ('y', y.type, 'y_pred', self.y_pred.type)
135 )
136 # check if y is of the correct datatype
137 if y.dtype.startswith('int'):
138 # the T.neq operator returns a vector of 0s and 1s, where 1
139 # represents a mistake in prediction
140 return T.mean(T.neq(self.y_pred, y))
141 else:
142 raise NotImplementedError()
143
144
145def cg_optimization_mnist(n_epochs=50, mnist_pkl_gz='mnist.pkl.gz'):

Callers 5

evaluate_lenet5Function · 0.95
cg_optimization_mnistFunction · 0.95
__init__Method · 0.45
__init__Method · 0.45
test_mlpFunction · 0.45

Calls

no outgoing calls

Tested by 1

test_mlpFunction · 0.36