提交 265e82d0 authored 作者: dan's avatar dan

small optimization of log likelihood function computation

上级 10d68dd8
...@@ -113,7 +113,7 @@ class LogisticRegression(object): ...@@ -113,7 +113,7 @@ class LogisticRegression(object):
# 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]]] # 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]]]
# and T.mean(LP[T.arange(y.shape[0]),y]) is the mean (across minibatch examples) of the elements in v, # and T.mean(LP[T.arange(y.shape[0]),y]) is the mean (across minibatch examples) of the elements in v,
# i.e., the mean log-likelihood across the minibatch. # i.e., the mean log-likelihood across the minibatch.
return T.log(self.p_y_given_x)[T.arange(y.shape[0]), y] return T.log(self.p_y_given_x[T.arange(y.shape[0]), y])
class HiddenLayer(object): class HiddenLayer(object):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论