提交 6e463193 authored 作者: James Bergstra's avatar James Bergstra

changed log.reg. cost function to be more explicit in n00b doc

上级 1c86708f
......@@ -169,11 +169,11 @@ training by simple gradient descent.
stepsize = T.scalar('stepsize') # a stepsize for gradient descent
# DECLARE SOME VARIABLES
# REGRESSION MODEL AND COSTS TO MINIMIZE
prediction = T.softmax(T.dot(x, w) + b)
cost = T.sum(T.kl_multinomial(targ=y, pred=prediction)) + l2_coef * T.sum(T.sum(w*w))
cross_entropy = T.sum(y * T.log(prediction) + (1-y) * T.log(1.0 - prediction), axis=1)
cost = T.sum(cross_entropy) + l2_coef * T.sum(T.sum(w*w))
# GET THE GRADIENTS NECESSARY TO FIT OUR PARAMETERS
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论