Skip to content

Commit 1e9844e

Browse files
author
Yoshua Bengio
committed
trying to make variable names and comments easier for the reader
1 parent 4921e47 commit 1e9844e

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

code/logistic_sgd.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ def negative_log_likelihood(self, y):
107107
Note: we use the mean instead of the sum so that
108108
the learning rate is less dependent on the batch size
109109
"""
110-
# y.shape[0] is the number of examples n in the minibatch
111-
# T.arange(y.shape[0]) is a vector containing [0,1,2,... n-1]
112-
# T.log(self.p_y_given_x) is a matrix L with one row per example and one column per class
113-
# L[T.arange(y.shape[0]),y] is a vector v containing [L[0,y[0]], L[1,y[1]], L[2,y[2]], ..., L[n-1,y[n-1]]]
114-
# and T.mean(L[T.arange(y.shape[0]),y]) is the mean (across minibatch examples) of the elements in v,
110+
# y.shape[0] is (symbolically) the number of rows in y, i.e., number of examples (call it n) in the minibatch
111+
# T.arange(y.shape[0]) is a symbolic vector which will contain [0,1,2,... n-1]
112+
# T.log(self.p_y_given_x) is a matrix of Log-Probabilities (call it LP) with one row per example and one column per class
113+
# LP[T.arange(y.shape[0]),y] is a vector v containing [LP[0,y[0]], LP[1,y[1]], LP[2,y[2]], ..., LP[n-1,y[n-1]]]
114+
# and T.mean(LP[T.arange(y.shape[0]),y]) is the mean (across minibatch examples) of the elements in v,
115115
# i.e., the mean log-likelihood across the minibatch.
116116
return -T.mean(T.log(self.p_y_given_x)[T.arange(y.shape[0]),y])
117117

@@ -240,7 +240,7 @@ def shared_dataset(data_xy):
240240
epoch = epoch + 1
241241
for minibatch_index in xrange(n_train_batches):
242242

243-
cost_ij = train_model(minibatch_index)
243+
minibatch_avg_cost = train_model(minibatch_index)
244244
# iteration number
245245
iter = epoch * n_train_batches + minibatch_index
246246

0 commit comments

Comments
 (0)