theano records

来源:互联网 发布:java获取11位时间轴 编辑:程序博客网 时间:2024/06/08 15:52
  1. theano.tensor.nnet.nnet.binary_crossentropy(output, target)
    计算如下的公式:
    这里写图片描述
    公式中t对应target且只能从0和1里取值,o代表output。

T.arange

-T.mean(T.log(self.p_y_given_x)[T.arange(y.shape[0]), y])

self.p_y_given_x :二维矩阵,每行代表一个样本;
y :向量
T.arange(L) 得到 [0,1…,L-1]
所以[T.arange(y.shape[0]), y]) 相当于[[0, 1…, L-1], [ y[0], y[1]…, y[L-1] ]]