Skip to content

Commit a738dee

Browse files
committed
fix documentation of nll.
1 parent 09d668e commit a738dee

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

doc/gettingstarted.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ This can be computed using the following line of code :
284284
# NLL is a symbolic variable ; to get the actual value of NLL, this symbolic
285285
# expression has to be compiled into a Theano function (see the Theano
286286
# tutorial for more details)
287-
NLL = -T.sum(T.log(p_y_given_x)[y.shape[0],y])
288-
# note on syntax: T.arange(y,shape[0]) is a vector of integers [0,1,2,...,len(y)].
287+
NLL = -T.sum(T.log(p_y_given_x)[T.arange(y.shape[0]),y])
288+
# note on syntax: T.arange(y.shape[0]) is a vector of integers [0,1,2,...,len(y)].
289289
# Indexing a matrix M by the two vectors [0,1,...,K], [a,b,...,k] returns the
290290
# elements M[0,a], M[1,b], ..., M[K,k] as a vector. Here, we use this
291291
# syntax to retrieve the log-probability of the correct labels, y.

doc/logreg.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ The following Theano code defines the (symbolic) loss for a given minibatch:
141141
.. code-block:: python
142142

143143
loss = -T.mean(T.log(p_y_given_x)[T.arange(y.shape[0]), y])
144-
# note on syntax: T.arange(y,shape[0]) is a vector of integers [0,1,2,...,len(y)].
144+
# note on syntax: T.arange(y.shape[0]) is a vector of integers [0,1,2,...,len(y)].
145145
# Indexing a matrix M by the two vectors [0,1,...,K], [a,b,...,k] returns the
146146
# elements M[0,a], M[1,b], ..., M[K,k] as a vector. Here, we use this
147147
# syntax to retrieve the log-probability of the correct labels, y.

0 commit comments

Comments
 (0)